TDateTime为实现TDateTime数据类型和使用TDateTime数据类型的日期-时间运行库例程的C++类。 TDateTime类继承了double型的val数据成员,其中包含了日期-时间值。TDateTime值的整数部分为自从12/30/1899以来的天数。其小数部分为天的时间。 下列为一些TDateTime值的例子以及对应的日期和时间: 值 日期和时间 0 12/30/1899 12:00 am 2.75 1/ 1/1900 6:00 pm -1.25 12/29/1899 6:00 am 35065 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对象的联合赋给TDateTime operator -= 把TDateTime 对象本身数据的rhs指定的TDateTime对象之间的差赋给TDateTime对象 operator < 比较两个TDateTime 对象 operator <= 比较两个TDateTime 对象 operator = 把rhs 内容赋给TDateTime operator == 比较两个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。可以通过改变日期和时间格式变量来改变字符串格式。
TDateTime::DayOfWeek 返回TDateTime 的week的天。 int __fastcall DayOfWeek()const; TDateTime 的DayOfWeek 对象为 1 到 7 之间的整数。Sunday 为week 的第一天,Saturday 为第七天。
TDateTime::DecodeDate 把TDateTime 值分为year ,month和day 值并把这些值分别存储在 year ,month 和 day 参数中。 void __fastcall DecodeDate(unsigned short* year,unsigned short* month,unsigned short* day)const; 需要访问TDateTime对象的year, month 和day 时,利用DecodeDate。
TDateTime::DecodeTime 把TDateTime 值分为 hour ,minute,second 和 millisecond 值并把这些值分别存储在 hour,min,sec 和 msec参数中。 void __fastcall DecodeTime(unsigned shot* hour,unsigned short*nim,unsigned short* sec,unsigned short* msec)const; 需要访问TDateTime对象的hour,minute,second或millisecond时,利用DecodeDate。
TDateTime::FileDate 把日期—时间值转换为DOS日期—时间标记。 int __fastcall FileDate()const;
TDateTime::FileDateToDateTime 把fileDate 参数指定的DOS文件的日期—时间值转换为TDateTime值。 static TDateTime __fastcall FileDateToDateTime(int fileDate);
TDateTime::FormatString 利用format 给定的格式格式化TDateTime 对象。 AnsiString __fastcall FormatString(const AnsiString& format); 支持下列分类符字符串:
分类符字符串 显示方式 c 日期使用 ShortDateFormat全局变量给的格式,时间使用 LongTimeformat 全局变量给的格式。假如分数是0,时间就不显示。 d 以数字表示日子,第一个字符不为 0 (1—31) dd 以数字表示日子,第一个字符为0 (01—31) ddd 以使用ShortDateFormat全局变量给的字符串的缩写(Sun—Sat) g表示日子 dddd 以使用Long Day Names全局变量给的字符串的全称(Sunday—Saturday)表示日子 ddddd 使用ShortDateFormat全局变量给的格式表示日期 dddddd 使用Long DateFormat 全局变量给的格式表示日期 m 以数字表示月份,第一个字符不为0 (1—12)。若m 后面跟着h或 hh,显示的是分钟,而不是月份 mm 以数字表示月份,第一个字符为0(01—12)。若mm 后面跟着h或 hh,显示的是分钟,而不是月份。 mmm 以使用ShortMonthNames 全局变量给的字符串的缩写( Jan — Dec)表示月份 mmmm 以使用Long Mames 全局变量给的字符串的全称(January — Decermber)表示月份 yy 以两位数字表示年(00—99) yyyy 以四位数字表示年(0000—9999) h 以数字表示小时,第一字符不为0(0—23) hh 以数字表示小时,第一字符为0(0—23 n 以数字表示分钟,第一个字符不为0(0—59) nn 以数字表示分钟,第一个字符为0(00—59) s 以数字表示秒,第一个字符不为0(0—59) ss 以数字表示秒,第一个字符为0(00—59) t 时间使用由ShortTimeFormst全局变量给定的格式 Ttt 时间使用由LongTimeFormat全局变量给定的格式 am/pm 时间为前面的h或hh分类符使用12小时时钟,后面跟"am"指的是上午的时间,后面跟"pm"指的是下午的时间。am/pm分类符可以是大写、小写或混合使用,都能相应的显示 a/p 时间为前面的h或hh分类符使用12小时时钟,后面跟"a"指的是上午的时间,后面跟"p"指的是下午的时间。a/p分类符可以是大写、小写或混合使用,都能相应的显示 ampm 时间为前面的h或hh分类符使用12小时时钟,后面跟TimeAMString 全局变量指的是上午的时间,后面跟TimePMString 全局变量指的是下午的时间 / 由DateSeparator 全局变量给定的日期分隔符 : 由TimeSeparator 全局变量给定的时间分隔符 'xx'/"xx" 用单引号或双引号括起的符号,表示不进行格式转换 格式分类符应写成大写或小写字母,两个产生同样效果。假如格式参数指的是空字符串,日期时间值被格式化成格式分类符给的是c。
TDateTime::operator - TDateTime的operator-被重载如下: TDateTime __fastcall operator - (const TDateTimeBase& rhs)const; 返回这个TDateTime 对象与rhs 的差。 TDateTime __fastcall operator - (const TDateTime& rhs)const; 返回两个TDatieTime 对象的差。 TDateTime __fastcall operator - (const double rhs)const; 返回这个TDateTime 对象与double的rhs 的差。 TDateTime __fastcall operator - (const int rhs)const; 返回这个TDateTime 对象与int 的rhs 的差。
<  
1/2 1 2 下一页 尾页 |