Date/Time Formatting Strings

These are formatting strings for use in the TO_DATE function.

  • CC=Two-digit century number
  • YYYY, YYY, YY, or Y=4-digit, 3-digit, 2-digit, or 1-digit year number
  • Y,YYY=4-digit year number with comma
  • Q=Quarter number (1 to 4)
  • MONTH, Month, or month=Month name (uppercase, mixed-case, lowercase, blank-padded to 9 characters)
  • MON, Mon, or mon=Abbreviated month name (uppercase, mixed-case, lowercase, blank-padded to 9 characters)
  • MM=Month number (01-12)
  • W=Week of month (1–5, the first week starts on the first day of the month)
  • WW=Week number of year (1–53, the first week starts on the first day of the year)
  • IW=ISO week number of year (the first Thursday of the new year is in week 1)
  • DAY, Day, or day=Day name (uppercase, mixed-case, lowercase, blank-padded to 9 characters)
  • DY, Dy, or dy=Abbreviated day name (uppercase, mixed-case, lowercase, blank-padded to 9 characters)
  • DDD=Day of year (001–366)
  • DD=Day of month as a number (01–31)
  • D=Day of week (1–7 Sunday is 1)
  • J=Julian day (days since January 1, 4712 BC)
  • HH24=Hour (24-hour clock, 00–23)
  • HH or HH12=Hour (12-hour clock, 01–12)
  • MI=Minutes (00–59)<br>SS=Seconds (00–59)
  • MS=Milliseconds (.000)<br>US=Microseconds (.000000)
  • AM or PM, A.M. or P.M., a.m. or p.m., am or pm=Upper and lowercase meridian indicators (for 12-hour clock)
  • TZ, tz=Upper and lowercase time zone abbreviation

 

Note: for use in the str_to_date function, see the following documentation: https://support.lityxiq.com/074111-DateTime-Formatting-Strings-for-str_to_date.