Delphi 时间函数全集.doc
文本预览下载声明
function StartOfTheYear(const AValue: TDateTime): TDateTime;function EndOfTheYear(const AValue: TDateTime): TDateTime;function StartOfAYear(const AYear: Word): TDateTime;function EndOfAYear(const AYear: Word): TDateTime;
function StartOfTheMonth(const AValue: TDateTime): TDateTime;function EndOfTheMonth(const AValue: TDateTime): TDateTime;function StartOfAMonth(const AYear, AMonth: Word): TDateTime;function EndOfAMonth(const AYear, AMonth: Word): TDateTime;
function StartOfTheWeek(const AValue: TDateTime): TDateTime;??????????{ISO 8601}function EndOfTheWeek(const AValue: TDateTime): TDateTime;???????????? {ISO 8601}function StartOfAWeek(const AYear, AWeekOfYear: Word;????????????????? {ISO 8601}?? const ADayOfWeek: Word = 1): TDateTime;function EndOfAWeek(const AYear, AWeekOfYear: Word;??????????????????? {ISO 8601}?? const ADayOfWeek: Word = 7): TDateTime;
所在单元:Unit DateUtils1、function DateOf(const AValue: TDateTime): TDateTime; 描述使用 DateOf 函数用来把一个 TDateTime 类型的变量转变成一个只带有日期的 TDateTime 类型变量。例如: showmessage(DateTimetostr(dateof(now()))); 你得到的是 2003/03/19 而 showmessage(DateTimetostr((now()))); 得到的是 2003/03/19 10:50:49
2、function DateTimeToStr(DateTime: TDateTime): string; 描述 DateTimeToString 函数将 TDateTime 类型的参数 DateTime 转换成一个字符串,使用给定的全局变量 ShortDateFormat 的格式,时间部分按照给定的全局变量 LongTimeFormat 的格式。其中 DateTime 为零的部分将不会显示出来。 例如: ShortDateFormat:=yyyy mm dd; showmessage(DateTimetostr((now()))); 你将得到:2003 03 19 10:50:49
3、procedure DateTimeToString(var Result: string; const Format: string; DateTime: TDateTime); 描述: DateTimeToString 方法将TDateTime类型的参数DateTime 按照由参数Format提供的格式转化成字符串,并保存在Result中。对于Format的格式类型,请看 Date-Time format strings 的帮助。 例如: DateTimeToString(result,yyyy mm dd,now()); 那么 result的结果为:2003 03 19 10:50:49
4、procedure DateTimeToSystemTime(DateTime: TDateTime; var SystemTime: TSystemTime); 描述:有时为了调用API函数来使用系统时间,你可以使用 DateTimeToSystemTime 方法,来将一个 TDateTime 类型的时间变量转换成一个 TSystemTime 类型的系统时间。
5、function DateTimeToUnix(const AValue: TDateTime ): Int64; 描述:使用 Dat
显示全部