Example #1
0
def gmdate(space, date_format, timestamp=int(pytime.time())):

    timelib_timezone = timelib.timelib_timezone('GMT')
    timelib_time = timelib.timelib_time_from_timestamp(timestamp,
                                                       timelib_timezone)

    return space.wrap(timelib.date_format(date_format, timelib_time))
Example #2
0
def date_default_timezone_set(interp, timezone_name):
    timelib_timezone = timelib.timelib_timezone(timezone_name)

    if timelib_timezone:
        w_datetimezone = W_DateTimeZone(k_DateTimeZone, [])
        w_datetimezone.timelib_timezone = timelib_timezone

        interp.timezone = w_datetimezone
        interp.timezone_set = True
        return interp.space.w_True
    else:
        interp.notice(
            "date_default_timezone_set(): Timezone ID '%s' is invalid" %
            timezone_name)
        return interp.space.w_False
Example #3
0
def date_default_timezone_set(interp, timezone_name):
    timelib_timezone = timelib.timelib_timezone(timezone_name)

    if timelib_timezone:
        w_datetimezone = W_DateTimeZone(k_DateTimeZone, [])
        w_datetimezone.timelib_timezone = timelib_timezone

        interp.timezone = w_datetimezone
        interp.timezone_set = True
        return interp.space.w_True
    else:
        interp.notice(
            "date_default_timezone_set(): Timezone ID '%s' is invalid"
            % timezone_name)
        return interp.space.w_False
Example #4
0
def default_timezone(interp, name='UTC'):
    from hippy.module.date.datetimezone_klass import k_DateTimeZone
    w_datetimezone = W_DateTimeZone(k_DateTimeZone, [])
    w_datetimezone.timelib_timezone = timelib.timelib_timezone(name)
    return w_datetimezone
Example #5
0
def gmdate(space, date_format, timestamp=int(pytime.time())):

    timelib_timezone = timelib.timelib_timezone('GMT')
    timelib_time = timelib.timelib_time_from_timestamp(timestamp, timelib_timezone)

    return space.wrap(timelib.date_format(date_format, timelib_time))