1 / 14
文档名称:

Delphi日期函数及日期加减.docx

格式:docx   大小:17KB   页数:14
下载后只包含 1 个 DOCX 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

Delphi日期函数及日期加减.docx

上传人:一花一叶 2019/11/13 文件大小:17 KB

下载得到文件列表

Delphi日期函数及日期加减.docx

相关文档

文档介绍

文档介绍:--------------------------校验:_____________-----------------------日期:_____________Delphi日期函数及日期加减Delphi日期函数、日期加减Delphi里有现成的函数可以实现日期加减,是在DateUtils单元里的。functionIncYear(constAValue:TDateTime;constANumberOfYears:Integer=1):TDateTime;//functionIncMonthisinSysUtilsfunctionIncWeek(constAValue:TDateTime;constANumberOfWeeks:Integer=1):TDateTime;functionIncDay(constAValue:TDateTime;constANumberOfDays:Integer=1):TDateTime;functionIncHour(constAValue:TDateTime;constANumberOfHours:Int64=1):TDateTime;functionIncMinute(constAValue:TDateTime;constANumberOfMinutes:Int64=1):TDateTime;functionIncSecond(constAValue:TDateTime;constANumberOfSeconds:Int64=1):TDateTime;functionIncMilliSecond(constAValue:TDateTime;constANumberOfMilliSeconds:Int64=1):TDateTime;Day开头的函数●UnitDateUtilsfunctionDateOf(constAvalue:TDateTime):TDateTime;描述使用DateOf函数用来把一个TDateTime类型的变量转变成一个只带有日期的TDateTime类型变量。例如:showmessage(DateTimetostr(dateof(now())));你得到的是2003/03/19而showmessage(DateTimetostr((now())));得到的是2003/03/1910:50:49●functionDateTimeToStr(DateTime:TDateTime):string;描述DateTimeToString函数将TDateTime类型的参数DateTime转换成一个字符串,使用给定的全局变量ShortDateFormat的格式,时间部分按照给定的全局变量LongTimeFormat的格式。其中DateTime为零的部分将不会显示出来。例如:ShortDateFormat:='yyyymmdd';showmessage(DateTimetostr((now())));你将得到:2003031910:50:49●procedureDateTimeToString(varResult:string;constFormat:string;DateTime:TDateTime);描述:DateTimeToString方法将TDateTime类型的参数DateTime按照由参数Format提供的格式转化成字符串,并保存在Result中。对于Format的格式类型,请看Date-Timeformatstrings的帮助。例如:DateTimeToString(result,'yyyymmdd',now());那么result的结果为:2003031910:50:49●procedureDateTimeToSystemTime(DateTime:TDateTime;varSystemTime:TSystemTime);描述:有时为了调用API函数来使用系统时间,你可以使用DateTimeToSystemTime方法,来将一个TDateTime类型的时间变量转换成一个TSystemTime类型的系统时间。●functionDateTimeToUnix(constAvalue:TDateTime):Int64;描述:使用DateTimeToUnix函数来将一个TDateTime型时间变量转换成一个相应的Unix格式的日期和时间。Unixdate-and-timevaluesareencodedasthenumberofsecondsthathaveelapsedsincemidnightatthestartofJanuary1,1970.●functionDateToStr(Date:TDateTime):string;描述:使用DateToStr函数能得到TDateTime