Skip to content

Commit 75d7a9a

Browse files
author
codehouseindia
authored
Merge pull request codehouseindia#531 from jayyeshh55/patch-5
Create date and time in python.py
2 parents 50b2cf0 + 5189e3c commit 75d7a9a

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

date and time in python.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
import datetime
3+
now = datetime.datetime.now()
4+
print "-" * 25
5+
print now
6+
print now.year
7+
print now.month
8+
print now.day
9+
print now.hour
10+
print now.minute
11+
print now.second
12+
13+
print "-" * 25
14+
print "1 week ago was it: ", now - datetime.timedelta(weeks=1)
15+
print "100 days ago was: ", now - datetime.timedelta(days=100)
16+
print "1 week from now is it: ", now + datetime.timedelta(weeks=1)
17+
print "In 1000 days from now is it: ", now + datetime.timedelta(days=1000)
18+
19+
print "-" * 25
20+
birthday = datetime.datetime(2012,11,04)
21+
22+
print "Birthday in ... ", birthday - now
23+
print "-" * 25

0 commit comments

Comments
 (0)