-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-date.py
executable file
·37 lines (28 loc) · 953 Bytes
/
test-date.py
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
#! /usr/bin/python
import datetime
if __name__ == "__main__":
today = datetime.date.today()
todaydetail = datetime.datetime.today()
print "--------------------------------------------------------------------------------"
print today
print todaydetail
print "--------------------------------------------------------------------------------"
print today.year
print today.month
print today.day
print todaydetail.year
print todaydetail.month
print todaydetail.day
print todaydetail.hour
print todaydetail.minute
print todaydetail.second
print todaydetail.microsecond
print "--------------------------------------------------------------------------------"
print today.isoformat()
print todaydetail.strftime("%Y/%m/%d %H:%M:%S")
today = datetime.datetime.today()
print today + datetime.timedelta(days=1)
newyear = datetime.datetime(2010,1,1)
print newyear + datetime.timedelta(days=7)
calc = today - newyear
print calc.days