Welcome toExcel.Tips.Net
Tips.Net Home
ExcelTips Home
Ask an Excel Question
Make a Comment
ExcelTips FAQ
ExcelTips Premium
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips
Advertise on the
ExcelTips Site
Assigning a Macro to a Keyboard Combination
Hiding Rows Based on a Cell Value
In Excel, dates and times are stored internally as numbers. These are only converted to legible dates and times when you format the cell using a date or time format. The following table lists the formatting codes that are specific to dates and times. You use these codes when you are creating a custom display format (Format | Cells | Number tab | Custom).
| Symbol | Meaning | |
|---|---|---|
| m | Displays the month or minutes as a number without a leading 0 | |
| mm | Displays the month or minutes as a number with a leading 0 | |
| mmm | Displays the month as abbreviated text (Jan, Feb, Mar, and so on) | |
| mmmm | Displays the month as text (January, February, March, and so on) | |
| d | Displays the day of the month as a number without a leading 0 | |
| dd | Displays the day of the month as a number with a leading 0 | |
| ddd | Displays the day of the week as abbreviated text (Sun, Mon, Tue, and so on) | |
| dddd | Displays the day of the week as text (Sunday, Monday, Tuesday, and so on) | |
| yy | Displays the year with two digits | |
| yyyy | Displays the year with four digits | |
| h | Displays the hour without a leading 0 | |
| hh | Displays the hour with a leading 0 | |
| s | Displays the seconds without a leading 0 | |
| ss | Displays the seconds with a leading 0 | |
| [ ] | When surrounding hours, minutes, or seconds place holders, displays hours greater than 24 or minutes and seconds greater than 60 | |
| AM am PM pm A a P p | Uses a 12-hour clock, displaying AM or PM as specified | |
| \ | Forces display of the following character | |
| . (period) | The decimal point. | |
| "text" | Displays the text within the quotes. |
To understand better the effect of the date and time codes, take a look at the following information, which shows several common date and time formats and how they affect numbers.
| Category | Format | Value | Displayed As | |||
|---|---|---|---|---|---|---|
| Date | m/d/yy | 34369 | 2/4/94 | |||
| d-mmm-yy | 34409 | 16-Mar-94 | ||||
| Time | h:mm AM/PM | 0.654166667 | 3:42 PM | |||
| [h]:mm:ss | 2.592673611 | 62:13:27 |
Notice that the numbers shown in the value column of these examples are the internal values stored by Excel for dates and times.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2179) applies to Microsoft Excel versions: 97 2000 2002 2003
Don't Go in Debt for Christmas! Tired of trying to keep up with the Joneses for Christmas? Want to enjoy the season rather than dread the aftermath? Learn how you can avoid the financial traps that spring up every Christmas.