Custom Date Format




Microsoft Excel provides various Date formats by default.

You can simply choose one of these formats and set it to Date cells. However question comes when none of the formats given by Microsoft Excel suffice the purpose.
Microsoft Excel supports many Date formats as follows:
Days, months, and years    
To displayCode
Months as 1–12m
Months as 01–12mm
Months as Jan–Decmmm
Months as January–Decembermmmm
Months as the first letter of the monthmmmmm
Days as 1–31d
Days as 01–31dd
Days as Sun–Satddd
Days as Sunday–Saturdaydddd
Years as 00–99yy
Years as 1900–9999yyyy

Similarly following Time formats are supported:

Hours, minutes, and seconds
To displayUse this code
Hours as 0–23h
Hours as 00–23hh
Minutes as 0–59m
Minutes as 00–59mm
Seconds as 0–59s
Seconds as 00–59ss
Hours as 4 AMh AM/PM
Time as 4:36 PMh:mm AM/PM
Time as 4:36:03 Ph:mm:ss A/P
Elapsed time in hours; for example, 25.02[h]:mm
Elapsed time in minutes; for example, 63:46[mm]:ss
Elapsed time in seconds[ss]
Fractions of a secondh:mm:ss.00

Not all of these formats are directly available to set through Formatting Dialog.
e.g. if I want to display Date in Sun-Sat format. There is no formatting available for Date datatype that I can choose and get the Date displayed in desired format. In such cases, "Custom" formatting comes to our rescue.
  • Select the Date cells for which you want to apply the specific format.
  • Go to "Format Cells" dialog.
  • Select "Custom" Category.
  • Specify "Type" as "ddd" (or any other format you wish to apply).
  • Select "OK".



Your desired Format is now applied to the selected cells.


No comments:

Post a Comment