Skip to content

Commit a9e0d0e

Browse files
author
codehouseindia
authored
Merge pull request codehouseindia#338 from Sgr1356/patch-1
count days till birthday
2 parents f7befcc + 4a0e3c7 commit a9e0d0e

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)