Skip to content

Commit 669b4d1

Browse files
author
codehouseindia
authored
Merge pull request codehouseindia#546 from aniketprasadgit/patch-1
Program to extract year, month, date and time.
2 parents fc60b86 + f073e75 commit 669b4d1

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

Extract year.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//Python program to extract year, month, date and time using Lambda
2+
3+
import datetime
4+
now = datetime.datetime.now()
5+
print(now)
6+
year = lambda x: x.year
7+
month = lambda x: x.month
8+
day = lambda x: x.day
9+
t = lambda x: x.time()
10+
print(year(now))
11+
print(month(now))
12+
print(day(now))
13+
print(t(now))

0 commit comments

Comments
 (0)