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 display | Code |
| Months as 1–12 | m |
| Months as 01–12 | mm |
| Months as Jan–Dec | mmm |
| Months as January–December | mmmm |
| Months as the first letter of the month | mmmmm |
| Days as 1–31 | d |
| Days as 01–31 | dd |
| Days as Sun–Sat | ddd |
| Days as Sunday–Saturday | dddd |
| Years as 00–99 | yy |
| Years as 1900–9999 | yyyy |
Similarly following Time formats are supported:
| Hours, minutes, and seconds | |
| To display | Use this code |
| Hours as 0–23 | h |
| Hours as 00–23 | hh |
| Minutes as 0–59 | m |
| Minutes as 00–59 | mm |
| Seconds as 0–59 | s |
| Seconds as 00–59 | ss |
| Hours as 4 AM | h AM/PM |
| Time as 4:36 PM | h:mm AM/PM |
| Time as 4:36:03 P | h: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 second | h: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