Goodspeed

导航

2011年11月7日 #

Python中时间的处理之——tzinfo篇

摘要: #! /usr/bin/python# coding=utf-8from datetime import datetime, tzinfo,timedelta"""tzinfo是关于时区信息的类tzinfo是一个抽象类,所以不能直接被实例化"""class UTC(tzinfo): """UTC""" def __init__(self,offset = 0): self._offset = offset def utcoffset(self, dt): return tim 阅读全文

posted @ 2011-11-07 11:24 Goodspeed 阅读(13831) 评论(0) 推荐(0) 编辑

Python中时间的处理之——date和time篇

摘要: #! /usr/bin/python# coding=utf-8from datetime import datetime,date,time"""date类型顾名思义就是只表示日期,而time只表示time"""today = date.today()attrs = [("year","年"),( 'month',"月"),( 'day',"日")]for k,v in attrs: "today.%s = %s 阅读全文

posted @ 2011-11-07 10:28 Goodspeed 阅读(3314) 评论(0) 推荐(0) 编辑