添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Datetime format strings - Amazon Redshift

Datetime format strings

You can find a reference for datetime format strings following.

The following format strings apply to functions such as TO_CHAR. These strings can contain datetime separators (such as ' - ', ' / ', or ' : ') and the following "dateparts" and "timeparts".

Datepart or timepart Meaning BC or B.C., AD or A.D., b.c. or bc, ad or a.d. Upper and lowercase era indicators Two-digit century number YYYY, YYY, YY, Y 4-digit, 3-digit, 2-digit, 1-digit year number Y,YYY 4-digit year number with comma IYYY, IYY, IY, I 4-digit, 3-digit, 2-digit, 1-digit International Organization for Standardization (ISO) year number Quarter number (1 to 4) MONTH, Month, month Month name (uppercase, mixed-case, lowercase, blank-padded to 9 characters) MON, Mon, mon Abbreviated month name (uppercase, mixed-case, lowercase, blank-padded to 3 characters) Month number (01-12) RM, rm Month number in Roman numerals (I–XII, with I being January, uppercase or lowercase) Week of month (1–5; the first week starts on the first day of the month.) Week number of year (1–53; the first week starts on the first day of the year.) ISO week number of year (the first Thursday of the new year is in week 1.) DAY, Day, day Day name (uppercase, mixed-case, lowercase, blank-padded to 9 characters) DY, Dy, dy Abbreviated day name (uppercase, mixed-case, lowercase, blank-padded to 3 characters) Day of year (001–366) Day of ISO 8601 week-numbering year (001-371; day 1 of the year is Monday of the first ISO week) Day of month as a number (01–31) Day of week (1–7; Sunday is 1)
Note

The D datepart behaves differently from the day of week (DOW) datepart used for the datetime functions DATE_PART and EXTRACT. DOW is based on integers 0–6, where Sunday is 0. For more information, see Date parts for date or timestamp functions .

ISO 8601 day of the week, Monday (1) to Sunday (7) Julian day (days since January 1, 4712 BC) Hour (24-hour clock, 00–23) HH or HH12 Hour (12-hour clock, 01–12) Minutes (00–59) Seconds (00–59) Milliseconds (.000) 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; valid for TIMESTAMPTZ only