WORKING WITH DATES
Python provides a rich set of date-related functions that are documented here:
http://docs.python.org/2/library/datetime.html
Listing A.7 displays the contents of the Python script Datetime2.py that displays various date-related values, such as the current date and time; the day of the week, month, and year; and the time in seconds since the epoch.
Listing A.7: Datetime2.py
import time
import datetime
print("Time in seconds since the epoch: %s" %time.time())
print("Current date and time: " , datetime.datetime.now())
print("Or like this: " ,datetime.datetime.now().
strftime("%y-%m-%d-%H-%M"))
print("Current year: ", datetime.date.today().
strftime("%Y"))
print("Month of year: ", datetime.date.today().
strftime("%B"))
print("Week number of the year: ", datetime.date.
today().strftime("%W"))
print("Weekday of the week: ", datetime.date.today().
strftime("%w"...