1. Olemis Lang
  2. bloodhound-trac

Source

bloodhound-trac / doc / api / trac_util_datefmt.rst

:mod:`trac.util.datefmt` -- Date and Time manipulation

Since version 0.10, Trac mainly uses datetime.datetime objects for handling date and time values. This enables us to properly deal with timezones so that time can be shown in the user's own local time.

Conversion

From "anything" to a datetime:

A datetime can be converted to milliseconds and microseconds timestamps. The latter is the preferred representation for dates and times values for storing them in the database, since Trac 0.12.

Besides to_datetime, there's a specialized conversion from microseconds timestamps to datetime:

Parsing

Formatting

Derivatives:

Propose suggestion for date/time input format:

Formatting and parsing according to user preferences:

jQuery UI datepicker helpers

Timezone utilities

List of all available timezones. If pytz is installed, this corresponds to a rich variety of "official" timezones, otherwise this corresponds to FixedOffset instances, ranging from GMT -12:00 to GMT +13:00.