Skip to main content
Converts a Joda-formatted string into a DATETIME value in the specified Joda DateTime format like yyyy-MM-dd HH:mm:ss.

Syntax

Parameters

  • str: the time expression you want to convert. It must be of the VARCHAR type.
  • format: the Joda DateTime format of the DATETIME value to be returned. For information about the formats available, see Joda DateTime.

Return value

  • If parsing the input string succeeds, a DATETIME value is returned.
  • If parsing the input string fails, NULL is returned.

Examples

Example 1: Convert the string 2014-12-21 12:34:56 into a DATETIME value in yyyy-MM-dd HH:mm:ss format.
Example 2: Convert the string 21/December/23 12:34:56 with a text-style month into a DATETIME value in dd/MMMM/yy HH:mm:ss format.
Example 3: Convert the string 21/December/23 12:34:56.123 accurate to milliseconds into a DATETIME value in dd/MMMM/yy HH:mm:ss.SSS format.

Keywords

STR_TO_JODATIME, DATETIME