Skip to main content
Converts the specified date into a string in the specified Joda DateTimeFormat pattern format.

Syntax

Parameters

  • date: the date you want to convert. It must be a valid date or date expression.
  • format: the format of the date and time to be returned. For information about the available formats, see Joda-Time format.

Return value

Currently, the return value is a string that contains a maximum of 128 bytes in length. If the length of the string converted from the specified date exceeds 128 bytes, NULL is returned.

Examples

Example 1: Convert the date 2020-06-25 15:58:51 into a string in yyyy-MM-dd format.
Example 2: Convert the date 2020-06-25 15:58:51 into a string in yyyy-MM-dd HH:mm:ss format.
Example 3: Convert the date 2020-06-25 15:58:51 into a string in MM dd ee EE format.
Example 4: Convert the date 2020-06-25 15:58:51 into a string in MMM dd ee EEE format.
Example 5: Convert the date 2020-06-25 15:58:51 into a string in MMMM dd ee EEEE format.
Example 6: Convert the date 2023-06-25 12:00:00 into a string in KK:mm:ss a format.
Example 7: Convert the date 2023-06-25 12:00:00 into a string in hh:mm:ss a format.
Example 8: Convert the date 2023-06-25 00:00:00 into a string in yyyyMMdd ''starrocks'' format.

Keywords

JODATIME_FORMAT, JODA, FORMAT