Skip to content

ExprStringNameSpace.strptime

Parse the string expression to a datetime/date/time type. The string must have format "%Y-%m-%d %H:%M:%S.%f"

You should specify a time format, otherwise it will default to datetime.

Parameters:

Name Type Description Default
format str

"datetime" (default) | "date" | "time"

'datetime'
Source code in pyquokka/expression.py
274
275
276
277
278
279
280
281
282
283
def strptime(self, format = "datetime"):
    """
    Parse the string expression to a datetime/date/time type. The string must have format "%Y-%m-%d %H:%M:%S.%f"

    You should specify a time format, otherwise it will default to datetime.

    Args:
        format (str): "datetime" (default) | "date" | "time"
    """
    return Expression(self.expr.sqlglot_expr.cast(format))