新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
PyhonDateTime的模塊如何在相關(guān)類方法中的整理
以下的文章就是對(duì)Pyhon DateTime的模塊在實(shí)際應(yīng)用過程中的具體介紹,本文涉及到的Pyhon DateTime相關(guān)的類方法整理,以及其相應(yīng)的代碼詳解,希望你在看完我們的文章會(huì)有所收獲。

相關(guān)聯(lián)的模塊還有time與calendar 其中的time我們上面已經(jīng)做了整理。呆會(huì)再整理下日歷相比time模塊來講的話這個(gè)模塊在運(yùn)算上更加方便一點(diǎn)?,F(xiàn)在整理一下其幫助文檔上面的內(nèi)容出來
構(gòu)造方法:
- datetime(year,month,day,[hour[,minute[,
second[,microsecond[,tzinfo]]]]])
參數(shù)說明:
- · MINYEAR
<= year <= MAXYEAR- · 1 <= month
<= 12- · 1 <= day
<= number of days in the given month and year- · 0
<= hour < 24- · 0
<= minute < 60- · 0
<= second < 60- · 0
<= microsecond < 1000000
Pyhon DateTime相關(guān)類方法整理
1、today() 返回當(dāng)前的本地時(shí)間值
- if __name__ == '__main__':
- datetimedatetimes = datetime.datetime(2001,12,2)
構(gòu)造方法參數(shù)要指明正確哦
- print datetimes.today()
返回:
- 2010-03-04 14:40:51.783000
即為當(dāng)前的時(shí)間值了
2、
- now([tz])
示例:
- if __name__ == '__main__':
- datetimedatetimes = datetime.datetime(2001,12,2)
- print datetimes.now()
輸出:
- 2010-03-04 14:43:09.127000
如果沒指定參數(shù)即表示當(dāng)前的時(shí)間值!以上的文章就是對(duì)Pyhon DateTime的相關(guān)實(shí)際應(yīng)用方案的部分介紹。
新聞標(biāo)題:PyhonDateTime的模塊如何在相關(guān)類方法中的整理
轉(zhuǎn)載源于:http://m.5511xx.com/article/cosgopp.html


咨詢
建站咨詢
