C++ Builder 參考手冊(cè) ? System::Sysutils ? DecodeTime
從日期時(shí)間類型數(shù)值里面解析出時(shí)、分蒸殿、秒产禾、毫秒
頭文件:#include <System.SysUtils.hpp>
命名空間:System::Sysutils
函數(shù)原型:
void __fastcall DecodeTime(const System::TDateTime DateTime, System::Word &Hour, System::Word &Min, System::Word &Sec, System::Word &MSec);
參數(shù):
- DateTime:日期時(shí)間類型變量脊凰;
- Hour:返回時(shí)卡儒,0 ~ 23蛆橡;
- Min:返回分拱绑,0 ~ 59邪意;
- Sec:返回秒九妈,0 ~ 59;
- MSec:返回毫秒雾鬼,0 ~ 999萌朱;
返回值:
- 無(wú),解析結(jié)果通過(guò)參數(shù) Hour, Min, Sec, MSec 返回策菜。
例:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
System::TDateTime dt = Sysutils::Now();
unsigned short uHour, uMin, uSec, uMSec;
Sysutils::DecodeTime(dt, uHour, uMin, uSec, uMSec);
UnicodeString s;
s.sprintf(L"現(xiàn)在時(shí)間是 %d:%02d:%02d.%03d", uHour, uMin, uSec, uMSec);
Memo1->Lines->Add(s);
}
運(yùn)行結(jié)果:
相關(guān):
- System::Dateutils::DecodeDateTime
- System::Dateutils::EncodeDateTime
- System::Dateutils::TryEncodeDateTime
- System::Dateutils::DateTimeToUnix
- System::Dateutils::UnixToDateTime
- System::Dateutils::YearOf
- System::Dateutils::MonthOf
- System::Dateutils::DayOf
- System::Dateutils::DayOfTheWeek
- System::Dateutils::DayOfTheMonth
- System::Dateutils::DayOfTheYear
- System::Dateutils::HourOf
- System::Dateutils::MinuteOf
- System::Dateutils::SecondOf
- System::Dateutils::MilliSecondOf
- System::Dateutils
- 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::FormatDateTime
- System::Sysutils::CurrentYear
- System::Sysutils::Now
- System::Sysutils::Date
- System::Sysutils::Time
- System::Sysutils
C++ Builder 參考手冊(cè) ? System::Sysutils ? DecodeTime