• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

Recommended Posts

一、datetime模块

2

#日期时间模块可以看成是时间加减的模块

导入日期时间

2

# 返回当前时间

打印(日期时间.日期时间.现在())

2019-03-07 16:22:14.544130

打印(日期时间。约会。从时间戳(时间。时间()))

2019-03-07

2

# 当前时间3天

打印(日期时间。日期时间。now()日期时间。时间增量(3))

2019-03-10 16:22:14.560599

2

# 当前时间-3天

打印(日期时间。日期时间。now()日期时间。时间增量(-3))

2019-03-04 16:22:14.568473

2

# 当前时间-3小时

打印(日期时间。日期时间。now()日期时间。时间增量(小时=3))

2019-03-07 19:22:14.575881

2

# 当前时间30分钟

打印(日期时间。日期时间。now()日期时间。时间增量(分钟=30))

2019-03-07 16:52:14.585432

2

3

# 时间替换

c_time=datetime.datetime.now()

print(c_time.replace(分钟=20,小时=5,秒钟=13))

2019-03-07 05:20:13.595493

Link to comment
Share on other sites