soton_corenlppy.time_helper module

Time utility functions

class soton_corenlppy.time_helper.UTC[source]

Bases: datetime.tzinfo

dst(dt)[source]

datetime -> DST offset as timedelta positive east of UTC.

tzname(dt)[source]

datetime -> string name of time zone.

utcoffset(dt)[source]

datetime -> timedelta showing offset from UTC, negative values indicating West of UTC

soton_corenlppy.time_helper.convert_datetime_tz_iso(date_without_timezone=None)[source]

Convert standard datetime.now object (e.g. 2014-03-06 14:13:27.733000) to ISO formatted (yyyy-mm-ddThh:mm:ss+zz:zz) and timezone aware (UTC timezone) datetime object

note: any microseconds will be truncated in serialized output
Parameters

kwargs – variable argument to override any default config values

Returns

configuration settings to be used by all common_parse_lib functions

Return type

dict

soton_corenlppy.time_helper.format_iso_datetime(date_with_timezone=None)[source]

Format date object (with a timezone) into an ISO formatted string yyyy-mm-ddThh:mm:ss+zz:zz

note: any microseconds will be truncated in serialized output
Parameters

kwargs – variable argument to override any default config values

Returns

configuration settings to be used by all common_parse_lib functions

Return type

dict

soton_corenlppy.time_helper.parse_iso_datetime(date_text=None)[source]

Parse ISO date string to a python datetime object with a UTC timezone

note: does not support microsconds such as ‘2014-02-01T01:02:03.123456+01:30’
Parameters

kwargs – variable argument to override any default config values

Returns

configuration settings to be used by all common_parse_lib functions

Return type

dict