Custom date formatting in excel

Format a date the way you want

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel 2010 Excel 2007 Excel for Mac 2011 More…Less

When you enter some text into a cell such as «2/2″, Excel assumes that this is a date and formats it according to the default date setting in Control Panel. Excel might format it as «2-Feb». If you change your date setting in Control Panel, the default date format in Excel will change accordingly. If you don’t like the default date format, you can choose another date format in Excel, such as «February 2, 2012″ or «2/2/12″. You can also create your own custom format in Excel desktop.

Follow these steps:

  1. Select the cells you want to format.

  2. Press CTRL+1.

  3. In the Format Cells box, click the Number tab.

  4. In the Category list, click Date.

    Pick Date in the Category list

  5. Under Type, pick a date format. Your format will preview in the Sample box with the first date in your data.

    Note: Date formats that begin with an asterisk (*) will change if you change the regional date and time settings in Control Panel. Formats without an asterisk won’t change.

  6. If you want to use a date format according to how another language displays dates, choose the language in Locale (location).

Tip: Do you have numbers showing up in your cells as #####? It’s likely that your cell isn’t wide enough to show the whole number. Try double-clicking the right border of the column that contains the cells with #####. This will resize the column to fit the number. You can also drag the right border of the column to make it any size you want.

If you want to use a format that isn’t in the Type box, you can create your own. The easiest way to do this is to start from a format this is close to what you want.

  1. Select the cells you want to format.

  2. Press CTRL+1.

  3. In the Format Cells box, click the Number tab.

  4. In the Category list, click Date, and then choose a date format you want in Type. You can adjust this format in the last step below.

    Pick Date in the Category list

  5. Go back to the Category list, and choose Custom. Under Type, you’ll see the format code for the date format you chose in the previous step. The built-in date format can’t be changed, so don’t worry about messing it up. The changes you make will only apply to the custom format you’re creating.

  6. In the Type box, make the changes you want using code from the table below.

To display

Use this 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

If you’re modifying a format that includes time values, and you use «m» immediately after the «h» or «hh» code or immediately before the «ss» code, Excel displays minutes instead of the month.

  • To quickly use the default date format, click the cell with the date, and then press CTRL+SHIFT+#.

  • If a cell displays ##### after you apply date formatting to it, the cell probably isn’t wide enough to show the whole number. Try double-clicking the right border of the column that contains the cells with #####. This will resize the column to fit the number. You can also drag the right border of the column to make it any size you want.

  • To quickly enter the current date in your worksheet, select any empty cell, press CTRL+; (semicolon), and then press ENTER, if necessary.

  • To enter a date that will update to the current date each time you reopen a worksheet or recalculate a formula, type =TODAY() in an empty cell, and then press ENTER.

When you enter some text into a cell such as «2/2″, Excel assumes that this is a date and formats it according to the default date setting in Control Panel. Excel might format it as «2-Feb». If you change your date setting in Control Panel, the default date format in Excel will change accordingly. If you don’t like the default date format, you can choose another date format in Excel, such as «February 2, 2012″ or «2/2/12″. You can also create your own custom format in Excel desktop.

Follow these steps:

  1. Select the cells you want to format.

  2. Press Control+1 or Command+1.

  3. In the Format Cells box, click the Number tab.

  4. In the Category list, click Date.

    Pick Date in the Category list

  5. Under Type, pick a date format. Your format will preview in the Sample box with the first date in your data.

    Note: Date formats that begin with an asterisk (*) will change if you change the regional date and time settings in Control Panel. Formats without an asterisk won’t change.

  6. If you want to use a date format according to how another language displays dates, choose the language in Locale (location).

Tip: Do you have numbers showing up in your cells as #####? It’s likely that your cell isn’t wide enough to show the whole number. Try double-clicking the right border of the column that contains the cells with #####. This will resize the column to fit the number. You can also drag the right border of the column to make it any size you want.

If you want to use a format that isn’t in the Type box, you can create your own. The easiest way to do this is to start from a format this is close to what you want.

  1. Select the cells you want to format.

  2. Press Control+1 or Command+1.

  3. In the Format Cells box, click the Number tab.

  4. In the Category list, click Date, and then choose a date format you want in Type. You can adjust this format in the last step below.

    Pick Date in the Category list

  5. Go back to the Category list, and choose Custom. Under Type, you’ll see the format code for the date format you chose in the previous step. The built-in date format can’t be changed, so don’t worry about messing it up. The changes you make will only apply to the custom format you’re creating.

  6. In the Type box, make the changes you want using code from the table below.

To display

Use this 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

If you’re modifying a format that includes time values, and you use «m» immediately after the «h» or «hh» code or immediately before the «ss» code, Excel displays minutes instead of the month.

  • To quickly use the default date format, click the cell with the date, and then press CTRL+SHIFT+#.

  • If a cell displays ##### after you apply date formatting to it, the cell probably isn’t wide enough to show the whole number. Try double-clicking the right border of the column that contains the cells with #####. This will resize the column to fit the number. You can also drag the right border of the column to make it any size you want.

  • To quickly enter the current date in your worksheet, select any empty cell, press CTRL+; (semicolon), and then press ENTER, if necessary.

  • To enter a date that will update to the current date each time you reopen a worksheet or recalculate a formula, type =TODAY() in an empty cell, and then press ENTER.

When you type something like 2/2 in a cell, Excel for the web thinks you’re typing a date and shows it as 2-Feb. But you can change the date to be shorter or longer.

To see a short date like 2/2/2013, select the cell, and then click Home > Number Format > Short Date. For a longer date like Saturday, February 02, 2013, pick Long Date instead.

  • If a cell displays ##### after you apply date formatting to it, the cell probably isn’t wide enough to show the whole number. Try dragging the column that contains the cells with #####. This will resize the column to fit the number.

  • To enter a date that will update to the current date each time you reopen a worksheet or recalculate a formula, type =TODAY() in an empty cell, and then press ENTER.

Need more help?

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Excel Custom Date Formats

You are not limited to using Excel’s built-in date formats. You can create your desired custom date formats in more than one way. You can even display your dates in a different language, change the appearance and order in which your dates are shown, add display color, and much more. In this article, you can learn how to format dates using a built-in format and how to format dates with use of the TEXT() function.

Using the DATE function available in Microsoft Excel is pretty simple as the function itself is very intuitive and self-explanatory. This function requires several variables to work, such as year, month and day, which can be inserted directly or entered as references to other cells with these variables. The Date function has the following syntax: DATE( year, month, day ). I have used the DATE function in many of my Calendars Templates, Project Gantt Chart, etc.

The DATE function can be used as a part of other functions or custom formulas and can also use other functions within for entering required variables. For example, one of the commonly used together with DATE functions is TODAY(), which returns the current date and can be used inside the DATE function and make it more dynamic.

The question that I have often been asked is how to format dates in the cell to display dates in alphanumerical format? Another issue is how to format dates using the TEXT() function? Additionally, why the date that is shown is either partly correct or displaying error when the spreadsheet is used in the non-English version of Microsoft Excel?

Examples

To follow along and see the examples described on this page in action, download the Excel file below.
Download the Example File (custom-date-formats.xlsx)

Change the Date Appearance with Format Cells Option

There a few methods in which you can approach these problems. The first method applies to scenarios where the content of the cell has to be displayed in some specific way, or you want to enter custom formatting. You can easily format the cell to show the date the way you need by following these steps:

  1. Select the cell (or multiple cells) you want to format
  2. Right-click on a cell (or cells) and select “Format Cells…” or use Ctrl+1 shortcut
  3. In the Format Cells dialog box choose the Date from the categories on the left
  4. Using the Locale drop-down list, choose a country or region of the date format you want to use
  5. Choose the desired format type in the Type section, then click OK to apply the format

Change the Date Format in Excel

The steps to apply custom formatting to the date entered into a cell or multiple cells are very similar.

  1. Select the cell (or multiple cells) you want to format
  2. Right-click on a cell (or cells) and select “Format Cells…” or use Ctrl+1 shortcut
  3. In the Format Cells window choose Custom from the categories on the left
  4. Select the desired formatting from the list in the Type section or enter your custom format type

Create a Custom Date Format in Excel

I won’t go through all custom formatting types that can be entered here as there are quite a few of them and it is quite frankly outside the scope of this article, but I will briefly touch upon the few of them. If you want to learn about all possible formatting types that you can create in Excel, please let me know in the comments below.

Here are some Date Format examples:

Format Code Cell Value Cell Appearance
dd/mm/yyyy 16/11/2018 16/11/2018
mm/dd/yyyy 16/11/2018 11/16/2018
mm-dd-yy 16/11/2018 11-16-18
mmmm d, yyyy 16/11/2018 November 16, 2018
d mmmm yyyy 16/11/2018 16 November 2018
d mmmm yyyy (dddd) 16/11/2018 16 November 2018 (Friday)
mm•dd•yyyy 16/11/2018 11•16•2018
“Date:” d mmmm yyyy 16/11/2018 Date: 16 November 2018

You can enter your custom format type by clicking in the area as shown on the image above. For example, if you want to display the date as November 16, 2018, you would enter the following: mmmm dd, yyyy. Check the table below for more date format options.

Format Code Description
dddd Full day of week names displayed as Monday-Sunday
ddd Abbreviated day of week names displayed as Mon-Sun
dd Days displayed with leading 0 as 01-31
d Days displayed as 1-31
mmmmm First letter of the month J-D
mmmm Month Names displayed in full as January-December
mmm Abbreviated month name displayed as Jan-Dec
mm Month number displayed with leading 0 as 01-12
m Month number displayed as 1-12
yyyy Year displayed in four digit format: 2018, 2019, etc.
y or yy Year displayed in two digit format: 18, 19, etc.

In this table, you can view some examples that you can apply to change the appearance of the date in the cell.

Format Code Date Appearance
d mmm ddd 6 Sep Thu
d mmm dddd 6 Sep Thursday
d mmm yyyy (dddd) 6 Sep 2018 (Thursday)
d mmm 6 Sep
d mmmm 6 September
dd/mm/yyyy 06/09/2018
dd-mm-yyyy 06-09-2018
d/m/yy 6/9/18
m/d/y 9/6/18
d mmm yy 6 Sep 18
mmm d, yy Sep 6, 18
d mmmm yyyy 6 September 2018
mmmm d, yyyy September 6, 2018
[$-C0A]mmmm d, yyyy febrero 6, 2018 (Spanish)

Additionally, the date can also appear in a different language by applying the language code to your formatting. For example, if you use the following language code [$-413] for Dutch, your date will appear in the Dutch language despite the system language settings of your computer. Language format can come in very handy, especially for use in spreadsheets where you want to display dates in various languages. I have posted the table with all applicable language codes at the bottom of this article.

All custom formatting applied via Excel built-in cell format option can be overwritten by conditional formatting or by accidental changes.

Format Dates with TEXT Function in Excel

If you are using the TEXT() function in your spreadsheet as a part of a formula or on its own, for applying a custom format to the date output, you can set the desired format right within the TEXT() function. To instruct the TEXT() function, you can use the same code that I have provided in the table above.

 =TEXT(A1,"mmmm d, yyyy") 

The formula above assumes that the date is in A1 (9/10/2018). The TEXT() function will apply the specified format to its output regardless of the initial format of the A1. So you should end up with the following output: September 9, 2018.

The output of the TEXT() function with a specified format cannot be changed with conditional formatting, which could sometimes be very useful. For example, you may not want to allow any system changes to override the format of your spreadsheet, such as system language changes. TEXT() function provides the ability to lock your set formats and can, to some extent prevent changes in the output.

One of many pros of using TEXT() function for setting a format of the date is the ability to set the different language for the output. You do this by including the language code with brackets to the format string, as shown in the example below

 =TEXT(A1,"[$-C0A]mmmm d, yyyy") 

Besides, you can make the TEXT() function even more dynamic by taking format string out of the worksheet function and placing it into any cell, then reference that cell in the format portion of the TEXT() function. Now you can change the format of the date by modifying the format string in the cell, without altering the TEXT() function.

 =TEXT(A1,C2) 

The formula in the example above assumes that A1 contains date and C2 includes the desired format string. The output of the TEXT() function will change every time you modify the format string in C2.

Custom Date Formats for Chart Labels and Axes

Custom Date format in format axis pane

As with almost everything else in Excel, few different methods can be used to apply a custom format to the dates in the chart axes and labels. The first method is to add the custom date format from the Format Axis pane. You should notice that the Linked to source box is unchecked.

You can also follow the other methods to add a custom format to the date. For example, you can modify the format of the data source first then apply this format to your chart axis by checking the Link to source box in Format Axis pane.

Any formats applied with TEXT() function to the data source whether in cells or chart axes, cannot be overridden.

Custom Location Codes for Dates

The table below includes all custom location codes for dates. You can use these location codes at the beginning of the format code string in square brackets for displaying month names and weekday names in other languages. The location/language code contains either three or four digits and/or letters, but if the leading digit is a zero, you do not need to include it.

Format Code Language/Location
0436 Afrikaans
041C Albanian
045E Amharic
0401 Arabic
042B Armenian
044D Assamese
082C Azeri (Cyrillic)
042C Azeri (Latin)
042D Basque
0423 Belarusian
0445 Bengali
0402 Bulgarian
0403 Catalan
045C Cherokee
0804 Chinese (Simplified)
0404 Chinese (Traditional)
041A Croatian
0405 Czech
0406 Danish
0465 Dhivehi
0413 Dutch
0466 Edo
0C09 English (Australian)
1009 English (Canadian)
0809 English (U.K.)
0409 English (U.S.)
0425 Estonian
0438 Faeroese
0464 Filipino
040B Finnish
040C French
0C0C French (Canadian)
0462 Frisian
0467 Fulfulde
0456 Galician
0437 Georgian
0407 German
0C07 German (Austrian)
0807 German (Swiss)
0408 Greek
0447 Gujarati
0468 Hausa
0475 Hawaiian
040D Hebrew
0439 Hindi
040E Hungarian
0469 Ibibio
040F Icelandic
0470 Igbo
0421 Indonesian
045D Inuktitut
0410 Italian
0411 Japanese
044B Kannada
0471 Kanuri
0460 Kashmiri (Arabic)
043F Kazakh
0457 Konkani
0412 Korean
0440 Kyrgyz
0476 Latin
0426 Latvian
0427 Lithuanian
042F Macedonian FYROM
043E Malay
044C Malayalam
043A Maltese
0458 Manipuri
044E Marathi
0450 Mongolian
0461 Nepali
0414 Norwegian Bokmal
0814 Norwegian Nynorsk
0448 Oriya
0472 Oromo
0463 Pashto
0429 Persian
0415 Polish
0416 Portuguese (Brazil)
0816 Portuguese (Portugal)
0446 Punjabi
0418 Romanian
0419 Russian
044F Sanskrit
0C1A Serbian (Cyrillic)
081A Serbian (Latin)
0459 Sindhi
045B Sinhalese
041B Slovak
0424 Slovenian
0477 Somali
0C0A Spanish
0441 Swahili
041D Swedish
045A Syriac
0428 Tajik
045F Tamazight (Arabic)
085F Tamazight (Latin)
0449 Tamil
0444 Tatar
044A Telugu
041E Thai
0873 Tigrigna (Eritrea)
0473 Tigrigna (Ethiopia)
041F Turkish
0442 Turkmen
0422 Ukrainian
0420 Urdu
0843 Uzbek (Cyrillic)
0443 Uzbek (Latin)
042A Vietnamese
0478 Yi
043D Yiddish
046A Yoruba

Other Notes about Custom Date Formats

You can quickly delete any custom formats created with built-in Format Cells option. To do so, open the Format Cells dialog box, select Custom from the categories on the left, select the custom format from the list then click Delete then click OK. All values that use the custom format which you want to delete will revert to the General format.

All custom date formats that you create belong to the workbook in which they were created. You will have to recreate the custom formats again in the new workbook or copy/paste the formatting from the file where you have initially created them. You can achieve this by copying and pasting the formatted cell, by copying the format code and pasting this code into the Format Cells dialog box or by using the Format Painter tool.

References

  • Excel Custom Number Format by Mynda Treacy, Excel MVP (MyOnlineTrainingHub.com)
  • Excel TEXT Function by Dave and Lisa Bruns (ExcelJet.net)

Date formatting is very important when you prepare any set of data, then there are different types of formatting used for different categories, which are different from our normal formatting which is dd/mm/yyyy. When you enter any date in MS-Excel then excel considers it as the default format of date as your computer has, but you can change their format in numerous ways, and also you can make your own custom format of a date. Such as 14-Dec, December 14, 2023, 14/12/2023, and may more depending on individual choices, you can change it. 

Here we are going to show the different ways to format a Date. Let’s understand it in a better way by taking an example, 

Step 1:  Open MS Excel and save with any name. Here we are going to save it by “Date Format” name.

Save a file with any name

Step 2: Take any date, like here we are taking 15/04/2001, which is in the format of mm-dd-yyyy and also it is the normal format of a date. 

Take any date.

Step 3: You can change the format by selecting that particular date cell, and press ctrl+1, then a new “format cells” window will open.

Select the date and then press ctrl+1

From this format window, you can choose date formatting according to your needs. If you want that date to be on 15 April 2001 format, then choose dd month yyyy from the format cell.

It shows outcome. After selecting the date format.

There are different examples of date formatting, here we are going to show you some of them.

Example 1: If you want to format the date in the dd-m-yy format then choose that option from the format cell., like shown in the below-mentioned image. 

Here we are taking dd-m-yy date format

Here you can see the outcome i.e.,15-4-01. 

It shows outcome 15-4-01

Example 2: If you want to format the date in dd.m.yy format, then choose the option which is shown in mentioned below image.

Here we are taking dd.m.yy date format

Here you can see the outcome i.e.,15.4.01.

It shows outcome 15.4.01

Example 3: If you want to format the date in Day, dd month, yyyy then choose the option from Format cell shown in the below-mentioned image.

Here we are taking day, dd month, yyyy date format

Here we can see it shows day and date as well i.e., Sunday, 15 April, 2001.

 It shows outcome Sunday, 15 April, 2001

Custom formatting on dates

So, here we are done with all the pre-defined formatting which are present in excel, but now we will learn Custom formatting on dates, in which we can make our own format also.

For “Custom Formatting”. Select the date. Press ctrl + 1. Choose “Custom” option. Write your own formatting in “Type” option. Then press OK.

Here we are writing own formatting in type of custom option

Suppose here in custom formatting, we want to format the date in “dd-mm-yyyy-dd-mm” format now the date comes in that format only.

Here we are writing dd-mm-yyyy-dd-mm format

So here you can see the date is in dd-mm-yyyy-dd-mm format i.e.,15-04-2001-15-04.

It shows outcome 15-4-2001-15-04

Even though dates and time are actually stored as a regular number known as the date serial number, we can make use of extensive Excel date and time formatting options to display them just the way we want.

We can access some quick date and time formats from the Home tab > in the Number group:

Excel Date and Time Formatting built in

We can also create our own custom date and time formats to suit our needs. Let’s take a look.

  1. Select the cell(s) containing the dates you want to format.
  2. Press CTRL+1, or right-click > Format Cells to open the Format Cells dialog box.
  3. On the Number tab select ‘Date’ in the Categories list. This brings up a list of default date formats you can select from in the ‘Type’ list. Likewise for the Time category.

Excel Date and Time Format cells

We aren’t limited to the defaults though. You can create your own Custom date or time formats in the ‘Custom’ category. These custom formats are saved for you to re-use in the current file.

Excel Date and Time custom Format cells

Custom Date Formatting Characters

Excel recognises the following characters and sets of characters for date formatting.

Character Explanation   Date Formatted
d Displays the day as a number without a leading zero. 3/09/2016 3
dd Displays the day as a number with a leading zero when appropriate. 3/09/2016 03
ddd Displays the day as an abbreviation (Sun to Sat). 3/09/2016 Sat
dddd Displays the day as a full name (Sunday to Saturday). 3/09/2016 Saturday
m Displays the month as a number without a leading zero. 3/09/2016 9
mm Displays the month as a number with a leading zero when appropriate. 3/09/2016 09
mmm Displays the month as an abbreviation (Jan to Dec). 3/09/2016 Sep
mmmm Displays the month as a full name (January to December). 3/09/2016 September
mmmmm Displays the month as a single letter (J to D). 3/09/2016 S
yy Displays the year as a two-digit number. 3/09/2016 16
yyyy Displays the year as a four-digit number. 3/09/2016 2016

 

Custom Date Formatting Examples

We can bring the characters together to create our own custom formats. Some examples below:

Excel Date Formatting example

Remember; the custom format doesn’t alter the underlying date serial number, it is still the same.

Custom Time Formatting Characters

Like dates, time also has its own set of custom formatting characters, as listed below:

Character Explanation    
h Displays the hour as a number without a leading zero.
[h] Displays elapsed time in hours. If you are working with a formula that returns a time in which the number of hours exceeds 24, use a number format that resembles [h]:mm:ss or [h]:mm
hh Displays the hour as a number with a leading zero when appropriate. If the format contains AM or PM, the hour is based on the 12-hour clock. Otherwise, the hour is based on the 24-hour clock.
m Displays the minute as a number without a leading zero.*
[m] Displays elapsed time in minutes. If you are working with a formula that returns a time in which the number of minutes exceeds 60, use a number format that resembles [mm]:ss.
mm Displays the minute as a number with a leading zero when appropriate.*
s Displays the second as a number without a leading zero.
[s] Displays elapsed time in seconds. If you are working with a formula that returns a time in which the number of seconds exceeds 60, use a number format that resembles [ss].
ss Displays the second as a number with a leading zero when appropriate. If you want to display fractions of a second, use a number format that resembles h:mm:ss.00.
AM/PM, am/pm, A/P, a/p Displays the hour using a 12-hour clock. Excel displays AM, am, A, or a for times from midnight until noon and PM, pm, P, or p for times from noon until midnight.

 

*Note: The m or mm code must appear immediately after the h or hh code or immediately before the ss code; otherwise, Excel displays the month instead of minutes.

Custom Time Formatting Examples

Excel Time Formatting example

Note: if your PC region settings have the Date & Time formats set to show the Short Time as hh:mm tt or the Long Time as hh:mm:ss tt then this may override any single ‘h’ formats and display them as ‘hh’.

The screenshot above is what I see with my PC region settings for the Short Time as h:mm tt. If you see something different when using a single ‘h’ format, then it will be down to your PC region settings.

More Excel Formatting

Custom cell formatting isn’t limited to dates and times. There is a plethora of formatting options for all types of numbers that we can use to get our reports looking just the way we want. Click here for our comprehensive guide to Excel custom number formatting.

Free eBook — Working with Date & Time in Excel

Everything you need to know about Date and Time in Excel — Download the free eBook and Excel file with detailed instructions.

Enter your email address below to download the comprehensive Excel workbook and PDF.

By submitting your email address you agree that we can email you our Excel newsletter.

What is a date in Excel?

A date is a number! And like any number (currency, percentage, decimal, …), you can customize your date format 👍

Dates are whole numbers

Usually, when you insert a date in a cell it is displayed in the format dd/mm/yyyy or mm/dd/yyyy.

Let’s say you have the date 01/01/2016 in a cell. If you change the cell’s format to Standard, the cell displays 42370 😕🤔

Date format

Explanation of the numbering

In Excel, a date is the number of days since 01/01/1900 (the first date in Excel).

So 42370 is the number of days between 01/01/1900 and 01/01/2016.

Date format

Dates can be displayed in different ways using the following 2 options (available in the Number Format dropdown in the main menu):

  • Short Date
  • Long Date

How to customize a date?

To customize a date:

  1. Open the dialog box Custom Number (with the shortcut Ctrl + 1 or by clicking on the menu More number formats at the bottom of the number format dropdown)

Menu to open the custom format

  1. In this dialog box, you select ‘Custom‘ in the Category list and write the date format code in ‘Type‘.

Dialogue box Custom Number Format

To format a date, you just write the parameter d, m or y a different number of times. For example,

  • dd/mm/yyyy will display 01/01/2016
  • dd mmm yyyy => 01 Jan 2016
  • mmmm yyyy => January 2016
  • dddd dd => Friday 01

In function of your language , the letter could be different:

  • t for «tag» (day) in German
  • j for «jour» (day) in French
  • a for «año» (year) in Spanish

Don’t write text in your cell !!!

With dates, one of the most common mistakes is to write text inside the format code (1 January 2016 for example). Never do this in Excel ⛔⛔⛔

If you do this, the contents of the cell will be Text and not a number

  • In Excel, text is always displayed on the left of a cell.
  • A number or a date is displayed on the right.

If you want to display the month in letters, just change the month format of your date.

Different examples of custom date

The following document shows you the same date but in different formats. The code for each date is in column A.

Example date format

Different writing of dates according to the format code

In the following document, you can see the impact of each format on the same date.

Example for each date code

MS Excel offers many possibilities how display date and time. The custom format can be set in the Format Cells… menu. Do the right-click and select Format Cells… .


RightClick menu in Excel

In the item Number select Custom.

Format Cells menu in Excel

Into the field Type: write the date/time codes.

Date format codes

Day

d – day number (0–31)

dd – day number (01–31) / two digits

ddd – day as an abbreviation (mon–sun)

dddd –day name (monday–sunday)

Month

m – month number (1–12)

mm – month number (01–12) / two digits

mmm –month as an abbreviation (Jan–Dec)

mmmm – month name (January–December)

mmmmm – the first letter of month name

Year

yy – year number (00–99) / two digits

yyyy – year number (1900–9999) / four digits

Examples of custom date format

Let’s have the date 3.1.2012

Code Date
dd/mm/yyyy 03/01/2012
mm/dd/yyyy 01/03/2012
d-m-yyyy 3-1-2012
dd-mm-yy 03-01-12
dddd Tuesday
dd. mm. yyyy dddd 03. 01. 2012 Tuesday
mmmm January
d. mmmm yyyy 3. January 2012
mmmm dd, yyyy January 03, 2012
dddd, mmmm dd yyyy Tuesday, January 03 2012
ddmmyy 030112
dd. “text” 03. text

Time format codes

h – hour number (0–23)

hh – hour number (00–23) / two digits

m – minute number (0–59)

mm – minute number (00–59)

s – second number (0–59)

ss – second number (00–59)

AM/PM or am/pm – Convert from 24 Hour to 12 Hour Time

[h] – elapsed time in hours (can be greater than 24, e.g. for sports results)

[mm] – elapsed time in minutes (can be greater than 60, e.g. for sports results)

[ss] – elapsed time in minutes (can be greater than 60, e.g. for sports results)

h:mm:ss.00 – fractions of seconds

Examples of custom time format

Let’s have the time 6:25:31

Code Time
hh.mm 06.25
hhmm 0625
h:mm:ss AM/PM 6:25:31 am
hh “hours and” mm “minutes” 06 hours and 25 minutes
[m] 385 (the number of minutes since 00:00:00)
[s] 23131 (the number of seconds since 00:00:00)

Examples of custom date/time format

Date and time formats can be combined. Notice that month and minute have the same code. Immediately after the hours writes Excel the minutes.

Default date/time: 4.11.2010 6:25

Code Date/Time
hh:mm dd/mm/yyyy 06:25 04/11/2012
dddd hh:mm Thursday 06:25

Note: In other language versions of Excel can be format codes different.

Понравилась статья? Поделить с друзьями:
  • Custom color in excel
  • Cut cell in excel
  • Custom borders in word
  • Customs word in english
  • Cuss word song lyrics