2.1.2. date_time

2.1.2.1. Module d1_common.date_time

Synopsis:Utilities for handling date-times in DataONE.
Created:2010-08-07
Author:DataONE (Dahl)

Functions

cast_datetime_to_utc(date_time) Set timezone to UTC without adjusting the date-time. Warning: If the
create_utc_datetime(*datetime_parts)
from_http_datetime(http_full_datetime) Parse HTTP Full Date formats. Each of the allowed formats are supported:
from_iso8601(iso8601_string) Create Python datetime from ISO8601 formatted string.
is_utc(date_time) Check that datetime contains time zone information and that the
normalize_datetime_to_utc(date_time[, timezone]) Adjust datetime to UTC by applying the timezone offset to the datetime and
strip_timezone(date_time) Create a naive datetime by stripping away any timezone information.
to_http_datetime(date_time) Format datetime to the preferred HTTP Full Date format, which is a
to_seconds_since_epoch(date_time) Convert datetime to epoch time / Unix timestamp. This is the number of
to_xsd_datetime(date_time) Format datetime to a valid xs:dateTime. (YYYY-MM-DDTHH:MM:SS.mmm+00:00)
utc_now() Now in the UTC timezone.

Classes

UTC Date-times in DataONE are required to have timezone information that is

Table Of Contents

Related Topics