TDateTime2008-04-04TDateTime为实现TDateTime数据类型和使用TDateTime数据类型的日期-时间运行库例程的C++类。TDateTime类继承了double型的val数据成员,其中包含了日期-时间值。TDateTime值的整数部分为自从12/30/1899以来的天数。其小数部分为天的时间。下列为一些TDateTime值的例子以及对应的日期和时间:值 日期和时间0 12/30/1899 12:00 am2.75 1/ 1/1900 6:00 pm-1.25 12/29/1899 6:00 am35065 1/ 1/1996 12:00 am要计算两个日期间的天的小数部分,把两个值相减。要在某天的小数部分增加一个日期-时间值,可把该小数加上日期-时间值。方法列表CurrentDate 返回当前日期作为TDateTime值CurrentDateTime 返回当前日期和时间作为TDateTime 值CurrentTime 返回当前时间作为TDateTime值DateString 把TDateTime值的日期转换为一个字符串DateTimeString 把TDateTime值转换为一个字符串DayOfWeek 返回 TDateTime的week的天DecodeDate 把TDateTime值分为year, month,和day值并把这些值分别存储在year, month和day参数中DecodeTime 把TDateTime值分为hour, minute, second,和millisecond值并把这些值分别存储在hour, min, sec和msec参数中FileDate 把日期 - 时间值转换为DOS日期 - 时间标记FileDateToDateTime 把FileDate参数指定的DOS文件的日期 - 时间值转换为TDateTime值FormatString 利用format给定的格式格式化TDateTime对象operator - 返回两个TDateTime集之间的差的新的TDateTime对象operator -- 返回一个TDateTime与Int参数之间差的新的TDateTime对象operator != 比较两个TDateTime对象的不相同性operator + 返回一个为两个TDateTime对象的联合的一个新TDateTime 对象operator += 把TDateTime 对象的本身数据与rhs 指定的TDateTime对象的联合赋给TDateTimeoperator -= 把TDateTime 对象本身数据的rhs指定的TDateTime对象之间的差赋给TDateTime对象operator < 比较两个TDateTime 对象operator <= 比较两个TDateTime 对象operator = 把rhs 内容赋给TDateTimeoperator == 比较两个TDateTime 对象的相同operator > 比较两个TDateTime 对象operator >= 比较两个TDateTime 对象operator AnsiString AnsiString 为转换操作符operator double double 为转换操作符operator int int 为转换操作符TDateTime TDateTime 构造函数TimeString 把TDateTime 对象转换为AnsiString方法TDateTime::CurrentDate返回当前日期作为TDateTime值。static TDateTime __fastcall CurrentDate( );检索当前日期并作为新的TDateTime 对象返回。TDateTime::CurrentDateTime返回当前日期和时间作为TDateTime值。static TDateTime __fastcall CurrentDateTime( );检索当前日期和时间并作为新的TDateTime 对象返回。TDateTime::CurrentTime返回当前时间作为TDateTime 值。static TDateTime __fastcall CurrentTime( );检索当前时间并作为新的TDateTime 对象返回。TDateTime::DateString把TDateTime 值的日期转换为一个字符串。AnsiString __fastcall DateString( )const;返回TDateTime对象作为一个AnsiString 的值。转换利用ShortDateFormat 变量指定的格式。TDateTime::DateTimeString把TDateTime 值转换为一个字符串。AnsiString __fastcall DateTimeString( )const返回一个AnsiString 对象,其中包含TDateTime 对象的日期和时间(val 数据成员)转换为字符串的值。如果TDateTime 值没有包含一个date 值,date 就显示为00/00/00。如果TDateTime 值没有包含一个time值,time 就显示为00:00:00 AM。可以通过改变日期和时间格式变量来改变字符串格式。