Galaxie Shell 0.2.6 documentation


Navigation:   | Index   | Search   | Top   | Up   | Prev   | Next   |
Table of Content: |glxshell.lib.iso8601 module |FixedOffset() |ParseError |parse_date() |

© Copyright 2020-2024, Galaxie Shell Team.

Top » glxshell » glxshell package » glxshell.lib package » glxshell.lib.iso8601 module

glxshell.lib.iso8601 module

glxshell.lib.iso8601.FixedOffset(offset_hours: float, offset_minutes: float, name: str) timezone[source]
exception glxshell.lib.iso8601.ParseError[source]

Bases: ValueError

Raised when there is a problem parsing a date string

glxshell.lib.iso8601.parse_date(datestring: str, default_timezone=datetime.timezone.utc) datetime[source]

Parses ISO 8601 dates into datetime objects

The timezone is parsed from the date string. However it is quite common to have dates without a timezone (not strictly correct). In this case the default timezone specified in default_timezone is used. This is UTC by default.

Parameters:
  • datestring (str) – The date to parse as a string

  • default_timezone (str or None) – A datetime tzinfo instance to use when no timezone is specified in the datestring. If this is set to None then a naive datetime object is returned.

Returns:

A datetime.datetime instance

Raises:

ParseError when there is a problem parsing the date or constructing the datetime instance.

Top » glxshell » glxshell package » glxshell.lib package » glxshell.lib.iso8601 module

© Copyright 2020-2024, Galaxie Shell Team.
This page is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License (CC BY-NC-SA 4.0).
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
See History and License for more information.

Last updated on None.
Created using Sphinx 8.0.2.