C++ Builder 参考手册 ➙ System::Sysutils ➙ Now
获取当前日期和时间。
头文件:#include <System.SysUtils.hpp>
命名空间:System::Sysutils
函数原型:
System::TDateTime __fastcall Now(void);
参数:
- 无
返回值:
- 当前日期和时间,当前地区的当前时间,本地的时间,精确到毫秒。
例:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TDateTime dt = Sysutils::Now();
ShowMessage(Sysutils::FormatDateTime(L"yyyy-mm-dd hh:nn:ss.zzz",dt));
}
运行结果:
相关:
- System::Sysutils::CurrentYear
- System::Sysutils::Now
- System::Sysutils::Date
- System::Sysutils::Time
- System::Sysutils::DecodeDate
- System::Sysutils::DecodeDateFully
- System::Sysutils::DecodeTime
- System::Sysutils::EncodeDate
- System::Sysutils::EncodeTime
- System::Sysutils::TryEncodeDate
- System::Sysutils::TryEncodeTime
- System::Sysutils::TryStrToDate
- System::Sysutils::TryStrToDateTime
- System::Sysutils::TryStrToTime
- System::Sysutils
- System::Dateutils::DayOfTheYear
- System::Dateutils::DayOfTheMonth
- System::Dateutils::DayOfTheWeek
- System::Dateutils::DayOf
- System::Dateutils::HourOf
- System::Dateutils::SecondOf
- System::Dateutils::MinuteOf
- System::Dateutils::MilliSecondOf
- System::Dateutils::DecodeDateTime
- System::Dateutils::EncodeDateTime
- System::Dateutils::TryEncodeDateTime
- System::Dateutils
C++ Builder 参考手册 ➙ System::Sysutils ➙ Now