Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to:
Databricks SQL
Databricks Runtime
Converts a timestamp to a string in the format fmt.
Syntax
date_format(expr, fmt)
Arguments
expr: A DATE, TIMESTAMP, or a STRING in a valid datetime format.- fmt: A STRING expression describing the desired format.
Returns
A STRING.
See Datetime patterns for details on valid formats.
If fmt contains an invalid datetime pattern, Azure Databricks raises INVALID_DATETIME_PATTERN.
Common error conditions
Examples
> SELECT date_format('2016-04-08', 'y');
2016
> SELECT date_format(current_date(), 'QQQQQ');
Error: INVALID_DATETIME_PATTERN