delphi日期函數(shù)、日期加減

delphi日期函數(shù)、日期加減

ID:13881160

大小:39.50 KB

頁數(shù):9頁

時(shí)間:2018-07-24

delphi日期函數(shù)、日期加減_第1頁
delphi日期函數(shù)、日期加減_第2頁
delphi日期函數(shù)、日期加減_第3頁
delphi日期函數(shù)、日期加減_第4頁
delphi日期函數(shù)、日期加減_第5頁
資源描述:

《delphi日期函數(shù)、日期加減》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。

1、delphi日期函數(shù)、日期加減2008-02-2909:12Delphi里有現(xiàn)成的函數(shù)可以實(shí)現(xiàn)日期加減,是在DateUtils單元里的。functionIncYear(constAValue:TDateTime;constANumberOfYears:Integer=1):TDateTime;//functionIncMonthisinSysUtilsfunctionIncWeek(constAValue:TDateTime;constANumberOfWeeks:Integer=1):TDateTime;functionIncDay(constAValue:TD

2、ateTime;constANumberOfDays:Integer=1):TDateTime;functionIncHour(constAValue:TDateTime;constANumberOfHours:Int64=1):TDateTime;functionIncMinute(constAValue:TDateTime;constANumberOfMinutes:Int64=1):TDateTime;functionIncSecond(constAValue:TDateTime;constANumberOfSeconds:Int64=1):TDateTim

3、e;functionIncMilliSecond(constAValue:TDateTime;constANumberOfMilliSeconds:Int64=1):TDateTime;Day開頭的函數(shù)●UnitDateUtilsfunctionDateOf(constAvalue:TDateTime):TDateTime;描述使用DateOf函數(shù)用來把一個(gè)TDateTime類型的變量轉(zhuǎn)變成一個(gè)只帶有日期的TDateTime類型變量。例如:showmessage(DateTimetostr(dateof(now())));你得到的是2003/03/19而showm

4、essage(DateTimetostr((now())));得到的是2003/03/1910:50:49●functionDateTimeToStr(DateTime:TDateTime):string;描述DateTimeToString函數(shù)將TDateTime類型的參數(shù)DateTime轉(zhuǎn)換成一個(gè)字符串,使用給定的全局變量ShortDateFormat的格式,時(shí)間部分按照給定的全局變量LongTimeFormat的格式。其中DateTime為零的部分將不會(huì)顯示出來。例如:ShortDateFormat:=’yyyymmdd’;showmessage(DateT

5、imetostr((now())));你將得到:2003031910:50:49●procedureDateTimeToString(varResult:string;constFormat:string;DateTime:TDateTime);描述:DateTimeToString方法將TDateTime類型的參數(shù)DateTime按照由參數(shù)Format提供的格式轉(zhuǎn)化成字符串,并保存在Result中。對(duì)于Format的格式類型,請(qǐng)看Date-Timeformatstrings的幫助。例如:DateTimeToString(result,’yyyymmdd’,now

6、());那么result的結(jié)果為:2003031910:50:49●procedureDateTimeToSystemTime(DateTime:TDateTime;varSystemTime:TSystemTime);描述:有時(shí)為了調(diào)用API函數(shù)來使用系統(tǒng)時(shí)間,你可以使用DateTimeToSystemTime方法,來將一個(gè)TDateTime類型的時(shí)間變量轉(zhuǎn)換成一個(gè)TSystemTime類型的系統(tǒng)時(shí)間?!駀unctionDateTimeToUnix(constAvalue:TDateTime):Int64;描述:使用DateTimeToUnix函數(shù)來將一個(gè)TDa

7、teTime型時(shí)間變量轉(zhuǎn)換成一個(gè)相應(yīng)的Unix格式的日期和時(shí)間。Unixdate-and-timevaluesareencodedasthenumberofsecondsthathaveelapsedsincemidnightatthestartofJanuary1,1970.●functionDateToStr(Date:TDateTime):string;描述:使用DateToStr函數(shù)能得到TDateTime日期時(shí)間類型的日期部分。日期的轉(zhuǎn)換格式依賴于全局變量ShortDateFormat?!駀unctionDayOf(constAvalue:TDateTi

8、me):W

當(dāng)前文檔最多預(yù)覽五頁,下載文檔查看全文

此文檔下載收益歸作者所有

當(dāng)前文檔最多預(yù)覽五頁,下載文檔查看全文
溫馨提示:
1. 部分包含數(shù)學(xué)公式或PPT動(dòng)畫的文件,查看預(yù)覽時(shí)可能會(huì)顯示錯(cuò)亂或異常,文件下載后無此問題,請(qǐng)放心下載。
2. 本文檔由用戶上傳,版權(quán)歸屬用戶,天天文庫負(fù)責(zé)整理代發(fā)布。如果您對(duì)本文檔版權(quán)有爭(zhēng)議請(qǐng)及時(shí)聯(lián)系客服。
3. 下載前請(qǐng)仔細(xì)閱讀文檔內(nèi)容,確認(rèn)文檔內(nèi)容符合您的需求后進(jìn)行下載,若出現(xiàn)內(nèi)容與標(biāo)題不符可向本站投訴處理。
4. 下載文檔時(shí)可能由于網(wǎng)絡(luò)波動(dòng)等原因無法下載或下載錯(cuò)誤,付費(fèi)完成后未能成功下載的用戶請(qǐng)聯(lián)系客服處理。