Database Transaction Time
Storing the current database transaction time in the database use the following syntax:
(note that you won't be able to read the value as a Python datetime object until the sync() method for the SQLObject is called, or the transaction is committed).
To store a time relative to the present time in a database column, we can make use of the fact that UTC_NOW is an "sql builder" type:
1 membership.dateexpires = UTC_NOW + datetime.timedelta(months=6)
The database transaction time can be retrieved like so:
Present Time
To create a Python datetime object that represents the present time, use the following code:
Note that the datetime.utcnow() method should not be used -- it creates a naïve datetime value, which can not be compared against other values in Launchpad.