Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Dates and Times in python

>>> # dates are easily constructed and formatted
>>> from datetime import date
>>> now = date.today()
>>> now
datetime.date(2003, 12, 2)
>>> now.strftime("%m-%d-%y. %d %b %Y is a %A on the %d day of %B.")
'12-02-03. 02 Dec 2003 is a Tuesday on the 02 day of December.'

>>> # dates support calendar arithmetic
>>> birthday = date(1964, 7, 31)
>>> age = now - birthday
>>> age.days
14368
Comment

PREVIOUS NEXT
Code Example
Python :: how draw shell in python 
Python :: python toupper 
Python :: turtle screen 
Python :: bytestring python 
Python :: tensorflow use growing memory 
Python :: keras sequential layer without input shape 
Python :: jupyter dataframe print all 
Python :: matplotlib yaxis off 
Python :: how to block empty space python login 
Python :: iterate over rows in numpy matrix python 
Python :: convert to string in python 
Python :: convert plt.show to image to show opencv 
Python :: end without space in python 
Python :: how to combine number of excel files into a single file using python or pandas 
Python :: python casting float to int 
Python :: threadpool python map 
Python :: pandas groupby 
Python :: jacobi iteration method python 
Python :: python tkinter importieren 
Python :: with function python 
Python :: python sh command 
Python :: how to print tables using python 
Python :: python check if value in string 
Python :: model.predict knn 
Python :: python terminal ui 
Python :: how to parse http request in python 
Python :: .add_prefix to certain columns python 
Python :: cv2.imshow not working in vscode 
Python :: py search and get objects from array 
Python :: get hours from datetime.timedelta in python (Django) 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =