How to use the isodate.tzinfo.FixedOffset function in isodate

To help you get started, we’ve selected a few isodate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla-services / socorro / socorro / unittest / lib / test_datetimeutil.py View on Github external
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import datetime

import isodate
import pytest

from socorro.lib import datetimeutil


UTC = datetimeutil.UTC
PLUS3 = isodate.tzinfo.FixedOffset(3, 0, "+03:00")


def test_utc_now():
    """
    Test datetimeutil.utc_now()
    """
    res = datetimeutil.utc_now()
    assert res.strftime("%Z") == "UTC"
    assert res.strftime("%z") == "+0000"
    assert res.tzinfo is not None


def test_string_to_datetime():
    """
    Test datetimeutil.string_to_datetime()
    """
github istSOS / istsos2 / lib__old / isodate / __init__.py View on Github external
from isodate.isostrf import DATE_EXT_ORD_COMPLETE, DATE_EXT_WEEK
from isodate.isostrf import DATE_EXT_WEEK_COMPLETE, DATE_MONTH, DATE_YEAR
from isodate.isostrf import TIME_BAS_COMPLETE, TIME_BAS_MINUTE
from isodate.isostrf import TIME_EXT_COMPLETE, TIME_EXT_MINUTE
from isodate.isostrf import TIME_HOUR
from isodate.isostrf import TZ_BAS, TZ_EXT, TZ_HOUR
from isodate.isostrf import DT_BAS_COMPLETE, DT_EXT_COMPLETE
from isodate.isostrf import DT_BAS_ORD_COMPLETE, DT_EXT_ORD_COMPLETE
from isodate.isostrf import DT_BAS_WEEK_COMPLETE, DT_EXT_WEEK_COMPLETE
from isodate.isostrf import D_DEFAULT, D_WEEK, D_ALT_EXT, D_ALT_BAS
from isodate.isostrf import D_ALT_BAS_ORD, D_ALT_EXT_ORD

__all__ = (parse_date, date_isoformat, parse_time, time_isoformat,
           parse_datetime, datetime_isoformat, parse_duration,
           duration_isoformat, ISO8601Error, parse_tzinfo,
           tz_isoformat, UTC, FixedOffset, LOCAL, Duration,
           strftime, DATE_BAS_COMPLETE, DATE_BAS_ORD_COMPLETE,
           DATE_BAS_WEEK, DATE_BAS_WEEK_COMPLETE, DATE_CENTURY,
           DATE_EXT_COMPLETE, DATE_EXT_ORD_COMPLETE, DATE_EXT_WEEK,
           DATE_EXT_WEEK_COMPLETE, DATE_MONTH, DATE_YEAR,
           TIME_BAS_COMPLETE, TIME_BAS_MINUTE, TIME_EXT_COMPLETE,
           TIME_EXT_MINUTE, TIME_HOUR, TZ_BAS, TZ_EXT, TZ_HOUR,
           DT_BAS_COMPLETE, DT_EXT_COMPLETE, DT_BAS_ORD_COMPLETE,
           DT_EXT_ORD_COMPLETE, DT_BAS_WEEK_COMPLETE,
           DT_EXT_WEEK_COMPLETE, D_DEFAULT, D_WEEK, D_ALT_EXT,
           D_ALT_BAS, D_ALT_BAS_ORD, D_ALT_EXT_ORD)
github rfletcher / plex-mlb / bundle / Contents / Libraries / isodate / isotzinfo.py View on Github external
def build_tzinfo(tzname, tzsign='+', tzhour=0, tzmin=0):
    '''
    create a tzinfo instance according to given parameters.
    
    tzname:
      'Z'       ... return UTC
      '' | None ... return None
      other     ... return FixedOffset
    '''
    if tzname is None or tzname == '':
        return None
    if tzname == 'Z':
        return UTC
    tzsign = ((tzsign == '-') and -1) or 1
    return FixedOffset(tzsign * tzhour, tzsign * tzmin, tzname)
github mercadopago / sdk-python / lib / mercadopago / lib / isodate / isotzinfo.py View on Github external
def build_tzinfo(tzname, tzsign='+', tzhour=0, tzmin=0):
    '''
    create a tzinfo instance according to given parameters.
    
    tzname:
      'Z'       ... return UTC
      '' | None ... return None
      other     ... return FixedOffset
    '''
    if tzname is None or tzname == '':
        return None
    if tzname == 'Z':
        return UTC
    tzsign = ((tzsign == '-') and -1) or 1
    return FixedOffset(tzsign * tzhour, tzsign * tzmin, tzname)
github istSOS / istsos2 / lib__old / isodate / isotzinfo.py View on Github external
def build_tzinfo(tzname, tzsign='+', tzhour=0, tzmin=0):
    '''
    create a tzinfo instance according to given parameters.

    tzname:
      'Z'       ... return UTC
      '' | None ... return None
      other     ... return FixedOffset
    '''
    if tzname is None or tzname == '':
        return None
    if tzname == 'Z':
        return UTC
    tzsign = ((tzsign == '-') and -1) or 1
    return FixedOffset(tzsign * tzhour, tzsign * tzmin, tzname)
github gweis / isodate / src / isodate / isotzinfo.py View on Github external
def build_tzinfo(tzname, tzsign='+', tzhour=0, tzmin=0):
    '''
    create a tzinfo instance according to given parameters.

    tzname:
      'Z'       ... return UTC
      '' | None ... return None
      other     ... return FixedOffset
    '''
    if tzname is None or tzname == '':
        return None
    if tzname == 'Z':
        return UTC
    tzsign = ((tzsign == '-') and -1) or 1
    return FixedOffset(tzsign * tzhour, tzsign * tzmin, tzname)