date_format
function
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.
Examples
> SELECT date_format('2016-04-08', 'y');
2016
Related functions
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for