Today - C++ Builder

C++ Builder 参考手册 ➙ System::Dateutils ➙ Today


获取今天的日期

头文件:#include
命名空间:System::Dateutils
函数原型:

System::TDateTime __fastcall Today(void);

参数:

  • 无;

返回值:

  • 获取今天的日期,时间部分等于 0,即 00:00:00;
  • 函数 Today 和 Date 比较:
    函数 Today 和 Date 实现相同的功能,返回值也相同,他们分别在不同的头文件和命名空间里面。

例:测试和比较函数 Now、Date、Time、DateOf、TimeOf、Today、Yesterday、Tomorrow:

#include 
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    Sysutils::FormatSettings.ShortDateFormat = L"yyyy'年'mm'月'dd'日'";
    Sysutils::FormatSettings.LongTimeFormat = L"hh:nn:ss";

    Memo1->Lines->Add(Sysutils::Now());
    Memo1->Lines->Add(Dateutils::DateOf(Sysutils::Now()));
    Memo1->Lines->Add(Sysutils::Date());
    Memo1->Lines->Add(Dateutils::TimeOf(Sysutils::Now()));
    Memo1->Lines->Add(Sysutils::Time());
    Memo1->Lines->Add(Dateutils::Today());
    Memo1->Lines->Add(Dateutils::Today()-1);
    Memo1->Lines->Add(Dateutils::Yesterday());
    Memo1->Lines->Add(Dateutils::Today()+1);
    Memo1->Lines->Add(Dateutils::Tomorrow());
}

相关:

  • System::Dateutils::Today
  • System::Dateutils::Yesterday
  • System::Dateutils::Tomorrow
  • System::Dateutils::DateOf
  • System::Dateutils::TimeOf
  • System::Dateutils::IsToday
  • System::Dateutils::IsSameDay
  • System::Dateutils
  • System::Sysutils::CurrentYear
  • System::Sysutils::Date
  • System::Sysutils::Now
  • System::Sysutils::Time
  • System::Sysutils

C++ Builder 参考手册 ➙ System::Dateutils ➙ Today

你可能感兴趣的:(Today - C++ Builder)