12 Date Time
12 Date Time
Times
Working with time in Python
The module for handling time is called "datetime" it contains four
classes:
◦ date - year, month, and day
◦ time - hour, minute, second, microsecond, and timezone
◦ datetime - holds both date and time (see above)
◦ timedelta - holds a 'difference' in time between two of the above
On retrieving a date encoded as TEXT you can convert the string back
to a Python datetime class.
◦ You can use the 'strptime' method to do this
Note, using SQL date/time functions may alter the format (i.e. add
microsecond precision or timezone info) so you should refrain from
using them.