-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_time_1.py
More file actions
executable file
·39 lines (32 loc) · 1.08 KB
/
Copy pathpython_time_1.py
File metadata and controls
executable file
·39 lines (32 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python3
# -*- utf-8 -*-
#
# Karl.Lv@outlook.com, KarlLv@126.com
#
# 06 July, 2017
#
# Moudles: time, datetime
import time
print('time.time(): ',time.time())
print('time.localtime(): ', time.localtime(time.time()))
print('time.gmtime(): ', time.gmtime())
print('time.localtime(): ', time.localtime())
print('time.strftime: ', time.strftime('%Y-%m-%d %H:%M:%S %A %B %Z',
time.localtime(time.time())))
print('time.clock(): ', time.clock())
print('time.daylight:', time.daylight)
print('time.timezone: ', time.timezone)
print('time.tzname: ', time.tzname)
###############################################################################
from datetime import date
from datetime import datetime
from datetime import timedelta
from datetime import tzinfo
from datetime import timezone
print('Today is: ', date.today())
print('timedelta.min: ', timedelta.min)
print('timedelta.max: ', timedelta.max)
print('timedelta.resolution: ', timedelta.resolution)
print('datetime.today: ', datetime.today())
print('datetime.now: ', datetime.now())
print('datetime.utcnow: ', datetime.utcnow())