C++ Builder 參考手冊 ? System::Dateutils ? EndOfAYear
某一年的結束時間,這一年的 12 月 31 日 23:59:59.999
頭文件:#include <System.DateUtils.hpp>
命名空間:System::Dateutils
函數(shù)原型:
System::TDateTime __fastcall EndOfAYear(const System::Word AYear);
參數(shù):
- AYear:年学少,1 - 9999鸠踪;
返回值:
- AYear 年的結束時間衡招,這一年的 12 月 31 日 23:59:59.999寞埠;
- 在程序里面掌眠,通常判斷小于下一年的1月1日00:00:00牙捉,而不是判斷小于等于這一年的末尾時間胡野;
- 比較函數(shù) EndOfAYear 和 EndOfTheYear:
? EndOfAYear 的參數(shù)是一個整數(shù)年材失;
? EndOfTheYear 的參數(shù)是日期時間;
只要這兩個函數(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", StartOfTheYear(dt)));
Memo1->Lines->Add(FormatDateTime(L"yyyy/mm/dd hh:nn:ss.zzz", EndOfTheYear(dt)));
unsigned short iYear = Dateutils::YearOf(dt);
Memo1->Lines->Add(iYear);
Memo1->Lines->Add(FormatDateTime(L"yyyy/mm/dd hh:nn:ss.zzz", StartOfAYear(iYear)));
Memo1->Lines->Add(FormatDateTime(L"yyyy/mm/dd hh:nn:ss.zzz", EndOfAYear(iYear)));
}
運行結果:
相關:
- 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 參考手冊 ? System::Dateutils ? EndOfAYear