C++ Builder 參考手冊 ? System::Sysutils ? DecodeDate
從日期時間類型數(shù)值里面解析出年佣耐、月虚婿、日
頭文件:#include <System.SysUtils.hpp>
命名空間:System::Sysutils
函數(shù)原型:
void __fastcall DecodeDate(const System::TDateTime DateTime, System::Word &Year, System::Word &Month, System::Word &Day);
參數(shù):
- DateTime:日期時間類型變量休雌;
- Year:返回年恳守,1 ~ 9999
- Month:返回月钧椰,1 ~ 12
- Day:返回日链患,1 ~ 31
返回值:
- 無慧邮,解析結(jié)果通過參數(shù) Year, Month, Day 返回馁筐。
例:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
System::TDateTime dt = Sysutils::Now();
unsigned short uYear, uMonth, uDay;
Sysutils::DecodeDate(dt, uYear, uMonth, uDay);
UnicodeString s;
s.sprintf(L"今天日期:%u 年 %u 月 %u 日", uYear, uMonth, uDay);
Memo1->Lines->Add(s);
}
運行結(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 參考手冊 ? System::Sysutils ? DecodeDate