Date format

This table shows the description of each time unit.
Time unit Description
Year
  • yyyy shows the year in 4-digit format.
  • yy shows the year in 2-digit format.

For example, for the year 1999, yyyy is 1999, while yy is 99.

Month
  • MMMM shows the full name of the month.
  • MMM shows the abbreviated name of the month.
  • MM shows the 2-digit format of the month.
  • M shows the 1-digit format of the month.

For example, for the month of February, MMMM is February, MMM is Feb, MM is 02, and M is 2.

Day
  • dd shows the day in 2-digit format.
  • d shows the day in 1-digit format.

For example, for January 2, dd is 02, while d is 2.

Hour
  • HH shows the time in 24-hour format.
  • hh shows the time in 12-hour format.
For example, for 8 PM, HH is 20, while hh is 08.

For AM/PM, you must add an a at the end.

Minute mm shows the time in minutes.
Second ss shows the time in seconds.
Separators
  • Slash (/), dash (-), or line space separates the day (dd), month (MM), and year (yy or yyyy).
  • Colon (:) separates hours (HH), minutes (mm), and seconds (ss).
Example

yyyy-MMM-dd hh:mm a returns this date: 2024-Jan-26 10:55 AM.