C++ Builder 參考手冊(cè) ? System::Dateutils ? StartOfAMonth
某個(gè)月的開始時(shí)間,這一個(gè)月的 1 日 00:00:00.000
頭文件:#include <System.DateUtils.hpp>
命名空間:System::Dateutils
函數(shù)原型:
System::TDateTime __fastcall StartOfAMonth(const System::Word AYear, const System::Word AMonth);
參數(shù):
- AYear:年涧团,1 - 9999缴饭;
- AMonth:月钻哩,1 - 12右犹;
返回值:
- AYear 年 AMonth 月的開始時(shí)間点楼,這一個(gè)月的 1 日 00:00:00.000宠纯;
- 比較函數(shù) StartOfAMonth 和 StartOfTheMonth:
? StartOfAMonth 的參數(shù)是整數(shù)年斗躏、月;
? StartOfTheMonth 的參數(shù)是日期時(shí)間衬浑;
只要這兩個(gè)函數(shù)參數(shù)的年月和日期的年月相同捌浩,返回值就相同。
例:
#include <System.DateUtils.hpp>
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TDateTime dt = Sysutils::Now();
Memo1->Lines->Add(FormatDateTime(L"yyyy/mm/dd hh:nn:ss.zzz", dt));
Memo1->Lines->Add(FormatDateTime(L"yyyy/mm/dd hh:nn:ss.zzz", StartOfTheMonth(dt)));
Memo1->Lines->Add(FormatDateTime(L"yyyy/mm/dd hh:nn:ss.zzz", EndOfTheMonth(dt)));
unsigned short iYear = Dateutils::YearOf(dt);
unsigned short iMonth = Dateutils::MonthOf(dt);
Memo1->Lines->Add(String().sprintf(L"%d年%d月", iYear, iMonth));
Memo1->Lines->Add(FormatDateTime(L"yyyy/mm/dd hh:nn:ss.zzz", StartOfAMonth(iYear,iMonth)));
Memo1->Lines->Add(FormatDateTime(L"yyyy/mm/dd hh:nn:ss.zzz", EndOfAMonth(iYear,iMonth)));
}
運(yùn)行結(jié)果:
相關(guān):
- System::Dateutils::StartOfTheYear
- System::Dateutils::EndOfTheYear
- System::Dateutils::StartOfTheMonth
- System::Dateutils::EndOfTheMonth
- System::Dateutils::StartOfTheWeek
- System::Dateutils::EndOfTheWeek
- System::Dateutils::StartOfTheDay
- System::Dateutils::EndOfTheDay
- System::Dateutils::StartOfAYear
- System::Dateutils::EndOfAYear
- System::Dateutils::StartOfAMonth
- System::Dateutils::EndOfAMonth
- System::Dateutils::StartOfAWeek
- System::Dateutils::EndOfAWeek
- System::Dateutils::StartOfADay
- System::Dateutils::EndOfADay
- System::Dateutils::DaysInYear
- System::Dateutils::DaysInAYear
- System::Dateutils::DaysInMonth
- System::Dateutils::DaysInAMonth
- System::Dateutils::WeeksInYear
- System::Dateutils::WeeksInAYear
- System::Dateutils
C++ Builder 參考手冊(cè) ? System::Dateutils ? StartOfAMonth