コード例 #1
0
ファイル: datetime_klass.py プロジェクト: CodeOps/hippyvm
def create_from_format(interp, format_string, time_string, w_datetimezone=None):
    func_name = "DateTime::createFromFormat"
    w_date = W_DateTime(interp._class_get("DateTime"), [])

    error = common.initialize_date_from_format(interp, func_name, w_date, format_string, time_string, w_datetimezone)

    if error:
        raise PHPException(
            interp._class_get("Exception").call_args(interp, [interp.space.wrap("%s(): %s" % (func_name, error))])
        )

    return w_date
コード例 #2
0
ファイル: funcs.py プロジェクト: youaani/hippyvm
def date_create_from_format(interp, format_string, time_string, w_datetimezone=None):
    w_date = W_DateTime(interp._class_get('DateTime'), [])

    error = common.initialize_date_from_format(
        interp, 'date_create_from_format',
        w_date, format_string, time_string,
        w_datetimezone
    )

    if error:
        return interp.space.w_False
    else:
        return date
コード例 #3
0
def create_from_format(interp,
                       format_string,
                       time_string,
                       w_datetimezone=None):
    func_name = "DateTime::createFromFormat"
    w_date = W_DateTime(interp._class_get('DateTime'), [])

    error = common.initialize_date_from_format(interp, func_name, w_date,
                                               format_string, time_string,
                                               w_datetimezone)

    if error:
        raise PHPException(
            interp._class_get('Exception').call_args(
                interp, [interp.space.wrap("%s(): %s" % (func_name, error))]))

    return w_date