天天看點

Python 标準類庫-日期類型之datetime子產品

标準類庫-日期類型之datetime子產品 

by:授客 QQ:1033553122

可用類型 3

實踐出真知 4

timedelta對象 4

class datetime.timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0) 4

類屬性 5

執行個體屬性(read-only): 5

支援的操作 6

執行個體方法 6

1、date對象 7

class datetime.date(year, month, day) 7

所有類方法(其它構造器) 7

classmethod date.today() 7

classmethod date.fromtimestamp(timestamp) 7

類屬性 7

date.min 7

date.max 7

date.resolution 8

執行個體屬性(read-only) 8

date.year 8

date.month 8

date.day 8

支援操作 8

執行個體方法 9

date.replace(year, month, day) 9

date.timetuple() 9

date.toordinal() 9

date.weekday() 10

date.isoweekday() 10

date.isocalendar() 10

date.isoformat() 10

date.ctime() 10

date.strftime(format) 11

date.__format__(format) 11

2、datetime對象 11

class datetime.datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None) 11

所有類方法(其它構造器) 11

classmethod datetime.today() 11

classmethod datetime.now(tz=None) 11

classmethod datetime.utcnow() 12

classmethod datetime.fromtimestamp(timestamp, tz=None) 12

classmethod datetime.utcfromtimestamp(timestamp) 12

classmethod datetime.fromordinal(ordinal) 12

classmethod datetime.combine(date, time) 12

classmethod datetime.strptime(date_string, format) 12

類屬性 13

datetime.min 13

datetime.max 13

datetime.resolution 13

執行個體屬性(read-only): 13

datetime.year 13

datetime.month 13

datetime.day 13

datetime.hour 13

datetime.minute 14

datetime.second 14

datetime.microsecond 14

datetime.tzinfo 14

支援的操作 14

執行個體方法 15

datetime.date() 15

datetime.time() 15

datetime.timetz() 15

datetime.replace([year[, month[, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]]]]]) 15

datetime.timetuple() 15

datetime.utctimetuple() 15

datetime.toordinal() 16

datetime.timestamp() 16

datetime.weekday() 16

datetime.isoweekday() 16

datetime.isocalendar() 16

datetime.isoformat(sep='T') 16

datetime.__str__() 17

datetime.ctime() 17

datetime.strftime(format) 17

datetime.__format__(format) 17

3、time對象 17

class datetime.time(hour=0, minute=0, second=0, microsecond=0, tzinfo=None) 17

類屬性 17

time.min 18

time.max 18

time.resolution 18

執行個體屬性(隻讀) 18

time.hour 18

time.minute 18

time.second 18

time.microsecond 18

time.tzinfo 18

執行個體方法 18

time.replace([hour[, minute[, second[, microsecond[, tzinfo]]]]]) 18

time.isoformat() 19

time.__str__() 19

time.strftime(format) 19

time.__format__(format) 19

time.utcoffset() 19

4、format格式 19

 篇幅問題,采用網盤連結分享:

[優]标準類庫-日期類型之datetime子產品.pdf

作者:授客

QQ:1033553122

全國軟體測試QQ交流群:7156436

Git位址:https://gitee.com/ishouke

友情提示:限于時間倉促,文中可能存在錯誤,歡迎指正、評論!

作者五行缺錢,如果覺得文章對您有幫助,請掃描下邊的二維碼打賞作者,金額随意,您的支援将是我繼續創作的源動力,打賞後如有任何疑問,請聯系我!!!

           微信打賞                       

支付寶打賞                  全國軟體測試交流QQ群  

Python 标準類庫-日期類型之datetime子產品
Python 标準類庫-日期類型之datetime子產品
Python 标準類庫-日期類型之datetime子產品