Value | Meaning |
---|---|
year'Y' | Year, all digits |
yearOfCentury'y' | Year, last 2 digits |
yearIsLeapYear'L' | '1' if the year is a leap year, '0' otherwise |
month'n' | Month index, 1 or 2 digits (1 = January) |
monthZeroPadded'm' | Month index, 2 digits with leading zeroes (01 = January) |
monthName'F' | Month name, full ("January", "February" ...) |
monthNameShort'M' | Month name, three letters ("Jan", "Feb" ...) |
daysInMonth't' | Number of days within the month, 2 digits |
weekOfYear'W' | ISO-8601 week index |
dayOfYear'z' | Day of year (January 1st = 0) |
dayOfMonth'j' | Day of month, 1 or 2 digits |
dayOfMonthZeroPadded'd' | Day of month, 2 digits with leading zeroes |
dayOfMonthOrdinalSuffix'S' | English ordinal suffix for the day of month, 2 characters |
dayOfWeekIndex'w' | Weekday index (0 = Sunday, 1 = Monday, ... 6 = Saturday) |
dayOfWeekIndexISO8601'N' | Weekday index, ISO-8601 numerical representation (1 = Monday, 2 = Tuesday, ... 7 = Sunday) |
dayOfWeekNameShort'D' | Weekday name, three letters ("Mon", "Tue", ...) |
dayOfWeekName'l' | Weekday name, full ("Monday", "Tuesday", ...) |
ampmLower'a' | "am" / "pm" |
ampmUpper'A' | "AM" / "PM" |
hour'G' | Hour (24-hour format), 1 or 2 digits |
hourZeroPadded'H' | Hour (24-hour format), 2 digits with leading zeroes |
hour12'g' | Hour (12-hour format), 1 or 2 digits (12 = midnight/noon) |
hour12ZeroPadded'h' | Hour (12-hour format), 2 digits with leading zeroes (12 = midnight/noon) |
minute'i' | Minute, 2 digits with leading zeroes |
second's' | Second, 2 digits with leading zeroes |
milliseconds'v' | Milliseconds within second, 3 digits |
millisecondsAlt'E' | Milliseconds within second, 3 digits (ae extension) |
microseconds'u' | Microseconds within second, 6 digits |
nanoseconds'9' | Nanoseconds within second, 9 digits (ae extension) |
timezoneName'e' | Timezone identifier |
timezoneAbbreviation'T' | Timezone abbreviation (e.g. "EST") |
timezoneOffsetWithColon'P' | Difference from GMT, with colon (e.g. "+02:00") |
timezoneOffsetWithoutColon'O' | Difference from GMT, without colon (e.g. "+0200") |
timezoneOffsetSeconds'Z' | Difference from GMT in seconds |
isDST'I' | '1' if DST is in effect, '0' otherwise |
dateTimeISO8601'c' | Full ISO 8601 date/time (e.g. "2004-02-12T15:19:21+00:00") |
dateTimeRFC2822'r' | Full RFC 2822 date/time (e.g. "Thu, 21 Dec 2000 16:01:07 +0200") |
dateTimeUNIX'U' | UNIX time (seconds since January 1 1970 00:00:00 UTC) |
escapeNextCharacter'\\' | Treat the next character verbatim (copy when formatting, expect when parsing) |
Based on php.net/date