python_reference/howtos_as_py_files/date_time.py

14 lines
248 B
Python
Raw Normal View History

2014-03-06 15:54:02 +00:00
# Sebastian Raschka, 03/2014
# Date and Time in Python
import time
# print time HOURS:MINUTES:SECONDS
# e.g., '10:50:58'
print(time.strftime("%H:%M:%S"))
# print current date DAY:MONTH:YEAR
# e.g., '06/03/2014'
print(time.strftime("%d/%m/%Y"))