User Tools

Site Tools


manipulating_dates_in_python

get today's day, month and year

% ipython3
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
IPython 7.20.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: 
import datetime
today = datetime.date.today()

In [2]: 
print(today)
2021-08-14

In [3]: 
type(today)
Out[3]: 
datetime.date

In [4]: 
[today.year, today.month, today.day]
Out[4]: 
[2021, 8, 14]
manipulating_dates_in_python.txt · Last modified: 2021/08/14 13:17 by raju