How to get today date class attributes in Python

1 Answer

0 votes
import datetime
 
today = datetime.date.today()     
print('ordinal:', today.toordinal())     
print('Year:', today.year)     
print('Mon:', today.month)     
print('Day:', today.day)



'''
run:

ordinal: 737215
Year: 2019
Mon: 6
Day: 5

'''

 



answered Jun 5, 2019 by avibootz

Related questions

2 answers 239 views
2 answers 208 views
1 answer 138 views
1 answer 207 views
1 answer 168 views
168 views asked Jun 5, 2019 by avibootz
...