Esempio n. 1
0
def setTimeZone( datetime, timezone ):
    try:
        tz = arrow.now( timezone ).tzinfo
    except:
        tz = arrow.now( getTimeZoneName( timezone ) ).tzinfo

    datetime = RPNDateTime.parseDateTime( datetime )
    datetime.tzinfo = tz
    return datetime
Esempio n. 2
0
def convertFromUnixTimeOperator( n ):
    try:
        result = RPNDateTime.parseDateTime( int( n ) ).getLocalTime( )
    except OverflowError:
        raise ValueError( 'out of range error' )
    except TypeError:
        raise ValueError( 'expected time value' )
    except OSError:
        raise ValueError( 'out of range error' )

    return result
Esempio n. 3
0
def convertToUnixTimeOperator( n ):
    try:
        result = RPNDateTime.parseDateTime( n ).timestamp
    except OverflowError:
        raise ValueError( 'out of range error' )
    except TypeError:
        raise ValueError( 'expected time value' )
    except OSError:
        raise ValueError( 'out of range error' )

    return result