标签:输出 style ima 获取 now() img ptime .com color
from datetime import datetime now=datetime.now() print(now) utcnow=datetime.utcnow() print(utcnow)
from datetime import datetime dt=datetime(2017,5,23,12,20) print(dt)
from datetime import datetime d=datetime.strptime(‘2017/09/30‘,‘%Y/%m/%d‘) print(d) d=datetime.strptime(‘2017年9月30日星期六‘,‘%Y年%m月%d日星期六‘) print(d) d=datetime.strptime(‘2017年9月30日星期六8时42分24秒‘,‘%Y年%m月%d日星期六%H时%M分%S秒‘) print(d) d=datetime.strptime(‘9/30/2017‘,‘%m/%d/%Y‘) print(d) d=datetime.strptime(‘9/30/2017 8:42:50‘,‘%m/%d/%Y %H:%M:%S‘) print(d)
from datetime import datetime d=datetime.now() print(d.strftime(‘%Y年%m月%d日%A%H时%M分%S秒‘)) print(d.strftime(‘%A,%B,%d,%Y‘)) print(d.strftime(‘%m/%d/%Y %H:%M:%S%p‘)) print(d.strftime(‘%B %d,%Y‘))
from datetime import datetime d=datetime.now() print(d.strftime(‘今天是%Y年%m月%d日‘)) print(d.strftime(‘今天是这周的第%w天‘)) print(d.strftime(‘今天是今年的第%j天‘)) print(d.strftime(‘今周是今年的%W周‘)) print(d.strftime(‘今天是当月的第%d天‘))
标签:输出 style ima 获取 now() img ptime .com color
原文地址:http://www.cnblogs.com/123hi/p/7616096.html