1>>> import datetime
2>>> today = datetime.datetime.now()
3>>> print today
42009-03-06 15:37:02.484000
5>>> today.strftime('%j')
6'065'
1import datetime
2now = datetime.datetime.now()
3print(now.year, now.month, now.day, now.hour, now.minute, now.second)
1from datetime import datetime
2
3day_of_year = datetime.now().timetuple().tm_yday