How to change date format in Excel and create custom formatting

The first part of our tutorial focuses of formatting dates in Excel and explains how to set the default date and time formats, how to change date format in Excel, how to create custom date formatting, and convert your dates to another locale.

Along with numbers, dates and times are the most common data types people use in Excel. However, they may be quite confusing to work with, firstly, because the same date can be displayed in Excel in a variety of ways, and secondly, because Excel always internally stores dates in the same format regardless of how you have formatted a date in a given cell.

Knowing the Excel date formats a little in depth can help you save a ton of your time. And this is exactly the aim of our comprehensive tutorial to working with dates in Excel. In the first part, we will be focusing on the following features:

Excel date format

Before you can take advantage of powerful Excel date features, you have to understand how Microsoft Excel stores dates and times, because this is the main source of confusion. While you would expect Excel to remember the day, month and the year for a date, that's not how it works...

Excel stores dates as sequential numbers and it is only a cell's formatting that causes a number to be displayed as a date, time, or date and time.

Dates in Excel

All dates are stored as integers representing the number of days since January 1, 1900, which is stored as number 1, to December 31, 9999 stored as 2958465.

In this system:

  • 2 is 2-Jan-1900
  • 3 is 3-Jan-1900
  • 42005 is 1-Jan-2015 (because it is 42,005 days after January 1, 1900)

Time in Excel

Times are stored in Excel as decimals, between .0 and .99999, that represent a proportion of the day where .0 is 00:00:00 and .99999 is 23:59:59.

For example:

  • 0.25 is 06:00 AM
  • 0.5 is 12:00 PM
  • 0.541655093 is 12:59:59 PM

Dates & Times in Excel

Excel stores dates and times as decimal numbers comprised of an integer representing the date and a decimal portion representing the time.

For example:

  • 1.25 is January 1, 1900 6:00 AM
  • 42005.5 is January 1, 2015 12:00 PM

How to convert date to number in Excel

If you want to know what serial number represents a certain date or time displayed in a cell, you can do this in two ways.

1. Format Cells dialog

Select the cell with a date in Excel, press Ctrl+1 to open the Format Cells window and switch to the General tab.

If you just want to know the serial number behind the date, without actually converting date to number, write down the number you see under Sample and click Cancel to close the window. If you want to replace the date with the number in a cell, click OK.
Use the Format Cells dialog to get the number behind a given date in Excel.

2. Excel DATEVALUE and TIMEVALUE functions

Use the DATEVALUE() function to convert an Excel date to a serial number, for example =DATEVALUE("1/1/2015").

Use the TIMEVALUE() function to get the decimal number representing the time, for example =TIMEVALUE("6:30 AM").

To know both, date and time, concatenate these two functions in the following way:

=DATEVALUE("1/1/2015") & TIMEVALUE("6:00 AM")
Use the DATEVALUE and TIMEVALUE functions to find the number behind a given date and time in Excel.

Note. Since Excel's serial numbers begins on January 1, 1900 and negative numbers aren't recognized, dates prior to the year 1900 are not supported in Excel.

If you enter such a date in a sheet, say 12/31/1899, it will be a text value rather than a date, meaning that you cannot perform usual date arithmetic on early dates. To make sure, you can type the formula =DATEVALUE("12/31/1899") in some cell, and you will get an anticipated result - the #VALUE! error.

If you are dealing with date and time values and you'd like to convert time to decimal number, please check out the formulas described in this tutorial: How to convert time to decimal number in Excel.

Default date format in Excel

When you work with dates in Excel, the short and long date formats are retrieved from your Windows Regional settings. These default formats are marked with an asterisk (*) in the Format Cell dialog window:
Default date formats in Excel

The default date and time formats in the Format Cell box change as soon as you change the date and time settings in Control Panel, which leads us right to the next section.

How to change the default date and time formats in Excel

If you want to set a different default date and/or time formats on your computer, for example change the USA date format to the UK style, go to Control panel and click Region and Language. If in your Control panel opens in Category view, then click Clock, Language, and Region > Region and Language > Change the date, time, or number format.

On the Formats tab, choose the region under Format, and then set the date and time formatting by clicking on an arrow next to the format you want to change and selecting the desired one from the drop-down list:
Setting the default date and time formats in Control panel

Tip. If you are not sure what different codes (such as mmm, ddd, yyy) mean, click the "What does the notation mean" link under the Date and time formats section, or check the Custom Excel date formats in this tutorial.

If you are not happy with any time and date format available on the Formats tab, click the Additional settings button in the lower right-hand side of the Region and Language dialog window. This will open the Customize dialog, where you switch to the Date tab and enter a custom short or/and long date format in the corresponding box.
Setting the custom date and time formats

How to quickly apply default date and time formatting in Excel

Microsoft Excel has two default formats for dates and time - short and long, as explained in default Excel date format.

To quickly change date format in Excel to the default formatting, do the following:

  • Select the dates you want to format.
  • On the Home tab, in the Number group, click the little arrow next to the Number Format box, and select the desired format - short date, long date or time.

Quickly applying the default date and time formatting in Excel

If you want more date formatting options, either select More Number Formats from the drop-down list or click the Dialog Box Launcher next to Number. This will open a familiar Format Cells dialog and you can change date format there.
Click the Dialog Box Launcher to open the Format Cells dialog.

Tip. If you want to quickly set date format in Excel to dd-mmm-yy, press Ctrl+Shift+#. Just keep in mind that this shortcut always applies the dd-mmm-yy format, like 01-Jan-15, regardless of your Windows Region settings.

How to change date format in Excel

In Microsoft Excel, dates can be displayed in a variety of ways. When it comes to changing date format of a given cell or range of cells, the easiest way is to open the Format Cells dialog and choose one of the predefined formats.

  1. Select the dates whose format your want to change, or empty cells where you want to insert dates.
  2. Press Ctrl+1 to open the Format Cells dialog. Alternatively, you can right click the selected cells and choose Format Cells… from the context menu.
  3. In the Format Cells window, switch to the Number tab, and select Date in the Category list.
  4. Under Type, pick a desired date format. Once you do this, the Sample box will display the format preview with the first date in your selected data.
  5. If you are happy for the preview, click the OK button to save the format change and close the window.

Changing the date format in Excel

If the date format is not changing in your Excel sheet, most likely your dates are formatted as text and you have to convert them to the date format first.

How to convert date format to another locale

Once you've got a file full of foreign dates and you would most likely want to change them to the date format used in your part of the world. Let's say, you want to convert an American date format (month/day/year) to a European style format (day/month/year).

The easiest way to change date format in Excel based on how another language displays dates is as follows:

  • Select the column of dates you want to convert to another locale.
  • Press Ctrl+1 to open the Format Cells
  • Select the language you want under Locale (location) and click OK to save the change.

Converting Excel dates to another locale

If you want the dates to be displayed in another language, then you will have to create a custom date format with a locale code.

Creating a custom date format in Excel

If none of the predefined Excel date formats is suitable for you, you are free to create your own.

  1. In an Excel sheet, select the cells you want to format.
  2. Press Ctrl+1 to open the Format Cells dialog.
  3. On the Number tab, select Custom from the Category list and type the date format you want in the Type box.
  4. Click OK to save the changes.

Creating a custom date format in Excel

Tip. The easiest way to set a custom date format in Excel is to start from an existing format close to what you want. To do this, click Date in the Category list first, and select one of existing formats under Type. After that click Custom and make changes to the format displayed in the Type box.

When setting up a custom date format in Excel, you can use the following codes.

Code Description Example (January 1, 2005)
m Month number without a leading zero 1
mm Month number with a leading zero 01
mmm Month name, short form Jan
mmmm Month name, full form January
mmmmm Month as the first letter J (stands for January, June and July)
d Day number without a leading zero 1
dd Day number with a leading zero 01
ddd Day of the week, short form Mon
dddd Day of the week, full form Monday
yy Year (last 2 digits) 05
yyyy Year (4 digits) 2005

When setting up a custom time format in Excel, you can use the following codes.

Code Description Displays as
h Hours without a leading zero 0-23
hh Hours with a leading zero 00-23
m Minutes without a leading zero 0-59
mm Minutes with a leading zero 00-59
s Seconds without a leading zero 0-59
ss Seconds with a leading zero 00-59
AM/PM Periods of the day
(if omitted, 24-hour time format is used)
AM or PM

To set up date and time format, include both date and time units in your format code, e.g. m/d/yyyy h:mm AM/PM. When you use "m" immediately after "hh" or "h" or immediately before "ss" or "s", Excel will display minutes, not a month.

When creating a custom date format in Excel, you can use a comma (,) dash (-), slash (/), colon (:) and other characters.

For example, the same date and time, say January 13, 2015 13:03, can be displayed in a various ways:

Format Displays as
dd-mmm-yy 13-Jan-15
mm/dd/yyyy 01/13/2015
m/dd/yy 1/13/15
dddd, m/d/yy h:mm AM/PM Tuesday, 1/13/15 1:03 PM
ddd, mmmm dd, yyyy hh:mm:ss Tue, January 13, 2015 13:03:00

Tip. Using a custom date format, you can easily display the day of the week from date.

How to create a custom Excel date format for another locale

If you want to display dates in another language, you have to create a custom format and prefix a date with a corresponding locale code. The locale code should be enclosed in [square brackets] and preceded with the dollar sign ($) and a dash (-). Here are a few examples:

  • [$-409] - English, Untitled States
  • [$-1009] - English, Canada
  • [$-407] - German, Germany
  • [$-807] - German, Switzerland
  • [$-804] - Bengali, India
  • [$-804] - Chinese, China
  • [$-404] - Chinese, Taiwan

You can find the full list of locale codes on this blog.

For example, this is how you set up a custom Excel date format for the Chinese locale in the year-month-day (day of the week) time format:
Creating a custom Excel date format for the Chinese locale

The following image shows a few examples of the same date formatted with different locale codes in the way traditional for the corresponding languages:
Custom date formats for different locales

Excel date format not working - fixes and solutions

Usually, Microsoft Excel understands dates very well and you are unlikely to hit any roadblock when working with them. If you happen to have an Excel date format problem, please check out the following troubleshooting tips.

A cell is not wide enough to fit an entire date

If you see a number of pound signs (#####) instead of dates in your Excel worksheet, most likely your cells are not wide enough to fit the whole dates.

Solution. Double-click the right border of the column to resize it to auto fit the dates. Alternatively, you can drag the right border to set the column width you want. For more details, see How to fix #### error in Excel.

Negative numbers are formatted as dates

Hash marks (#####) are also displayed when a cell formatted as a date or time contains a negative value. Usually it's a result returned by some formula, but it may also happen when you type a negative value into a cell and then format that cell as a date.

If you want to display negative numbers as negative dates, two options are available to you:

Solution 1. Switch to the 1904 date system.

Go to File > Options > Advanced, scroll down to the When calculating this workbook section, select the Use 1904 date system check box, and click OK.
Switching to the 1904 date system

In this system, 0 is 1-Jan-1904; 1 is 2-Jan-1904; and -1 is displayed as a negative date -2-Jan-1904.
Negative numbers are displayed as negative dates

Of course, such representation is very unusual and takes time to get used to, but this is the right way to go if you want to perform calculations with early dates.

Solution 2. Use the Excel TEXT function.

Another possible way to display negative numbers as negative dates in Excel is using the TEXT function. For example, if you are subtracting C1 from B1 and a value in C1 is greater than in B1, you can use the following formula to output the result in the date format:

=TEXT(ABS(B1-C1),"-d-mmm-yyyy")
Use the Excel TEXT function to display negative numbers as dates.

You may want to change the cell alignment to right justified, and naturally, you can use any other custom date formats in the TEXT formula.

Note. Unlike the previous solution, the TEXT function returns a text value, that is why you won't be able to use the result in other calculations.

Dates are imported to Excel as text values

When you are importing data to Excel from a .csv file or some other external database, dates are often imported as text values. They may look like normal dates to you, but Excel perceives them as text and treats accordingly.

Solution. You can convert "text dates" to the date format using Excel's DATEVALUE function or Text to Columns feature. Please see the following article for full details: How to convert text to date in Excel.

Tip. If none of the above tips worked for you, then try to remove all formatting and then set the desired date format.

This is how you format dates in Excel. In the next part of our guide, we will discuss various ways of how you can insert dates and times in your Excel worksheets. Thank you for reading and see you next week!

910 comments

  1. 23rd Aug 2023 convert to 23-Aug-23 format

  2. 15/02/20 19/55/12 how to change time form 19.02.2020 15:07:12

  3. Hi! Need your help pls. I downloaded a data with this sample date and time
    Fri, 04 Aug 2023 01:12:40 GMT
    However, when I opened the file it shows 1691111560. Please advise. Thank you!

  4. Hi Alex,
    My Excel show as 08-01-2023 18:00 and read as by excel as 8 Januari 2023 09:00 PM.
    How to change excel to read as 1 August 2023 09:00 PM ? I usually using text to column, but now its not working, maybe because there's hour number in that date.. I dunno..

  5. Can someone help how to fill the dates in series without changing the hh:mm?
    07-Dec-22 16:20
    00-Jan-00 16:22
    00-Jan-00 16:27
    00-Jan-00 16:36
    00-Jan-00 17:03
    00-Jan-00 18:09
    00-Jan-00 18:28
    00-Jan-00 18:38
    00-Jan-00 18:49
    00-Jan-00 19:06
    00-Jan-00 19:18
    00-Jan-00 19:28

  6. Can someone help how to fill the dates in series without changing the hh:mm?

  7. Is there way to change a mm/dd/yyyy date into the week of the month or week of the year it falls into?

  8. very good and easy

  9. Bagaimana kalau mau tulisan bulannya huruf kapital
    contoh JULI 15, 2023

  10. how to write date in format March' 2021

  11. What date would it be in 41.56 years from now

  12. How to conert date 01/01/2020 to 01.01.2020

  13. if you receive a file with dates in American format ("mm/dd/yy") and you want to convert them to European format,
    here's a simple method:
    suppose the date in cell B3 is: 4/15/2013 and you want to convert it to 15/04/23,
    you can do it in one formula:

    =LET(a,TEXTSPLIT(B3,"/"),DATE(INDEX(a,3),INDEX(a,1),INDEX(a,2)))

  14. Hi. I am used to inputting dates using the format MM/DD/YY or YYYY. However, after updating, it seems that Excel doesn't read this as a date anymore. It would only recognize a date if my input format is DD/MM/YY. How do i make Excel read dates inputted as MM/DD/YYYY? Thanks in advance!

  15. Hi, I am trying to format date in excel but a hashtag # keeps displaying from the output.

    • Hi! Specify which date you are trying to format and which format template you are using. Also pay attention to the width of the column. Perhaps the column needs to be wider.

  16. Your articles are excellent – very clear and complete. I find them very useful. In this one the section "How to create a custom Excel date format for another locale" seems to omit a couple of details that interest me. My MSOffice language is UK English and I have a workbook where I want to optionally be able to display everything in German. For cells containing dates I find that, as you say, a format like "[$-407]d mmm yy" displays dates in German. But when dates are displayed in German it is logical to expect to be able to enter them in German too, but I am finding with (Excel 2010, Win10) that Excel does not apply the locale code in the format to input. For example, if I enter "3 okt" Excel does not recognise that as a valid date: it accepts only "3 oct". Is there any way to get Excel to parse input in German, or any other locale than the current MSOffice language? (If conditional formatting can do it, that would be a solution. I'm also competent in VBA.)
    A second point you didn't mention is that when my workbook is opened on a French computer the cell format I just mentioned now needs to be "[$-407]j mmm aa". Should Excel notice when a workbook developed on an English computer is being opened on a French one, and convert cell formats automatically? Or should I expect to have to do this myself in a VBA workbook-open event or suchlike?

    • Hi! If you do not use the standard date formats, but use custom formatting and specify a country code, Excel will not change the code on its own. Also, the date entry format depends only on your computer's local settings.

  17. Hello,
    I downloaded an ebay report and want to convert this date/time format: Sep-26-20 20:29:03 PDT to: 09/26/2020
    I've eliminated the trailing characters with the =left function and that left me with Sep-26-20 but I cannot get that to convert to 9/26/20. I tried changing the format but that did not correct the format. I would appreciate any tips of help to move this forward. Thanks!

    • Hi!
      Extract the required text strings with the MID and LEFT function. Create a date using the DATE function.
      I believe the following formula will help you solve your task:

      =DATE(20&MID(A1,8,2),MONTH(DATEVALUE(1&LEFT(A1,3))),MID(A1,5,2))

      • Absolutely brilliant. Thank you!

  18. Thank You

  19. Hi. I want to change my this date format 31/10/2022 12:49 AM to 2022-10-31T00:49:00 this format in excel how can I do it? Help me find this out.

    Thanks in advance.

      • But what I am trying to ask is this is the format in my first column 31/10/2022 12:49 AM (Assume column as A2).

        I want the next column to be linked with before column(which is A2) as get output as 2022-10-31T00:49:00.

    • I want to change my date from 3/27/2023 to 03/23/2023 the date is on left hand side instead of right hand side.

      Have read the article more than twice and tried all the suggestions but non work for what I want.

      Please kindly help.

  20. how to change number format to Date format Ex: 20230207 to07/03/2023

  21. Hi,
    I changed the date locale to German so the date I enter displays in the German format d/m/y. However, I still have to enter the date in the US way m/d/y.
    How can I change the cell so that I can enter the date in the German way?

  22. Hi Alex, I have this problem:
    A list with some dates in this format mm/dd/yyyy, others like this mm/yyyy, and others only like this yyyy. The first two excel can handle fine, but the yyyy can't, for example, I have 2022 and excel transform to 7/14/1905, but I neet to transform into 01/01/yyyy if no, I can't sort by oldest or newest.
    Do you know any solution to this?

  23. I want to change date format from 04/26/2018 to 26/04/2018. I tried using all custom options but there is no change, please suggest some formula for the same

  24. how do I change a date format from 04.02.2023 to 04/02/2023 in a sales converter in excel?

  25. I have date in format dd/mm/yyyy… i want to change format as mm-dd-yyyy

  26. Hi Alex!
    Thanks for this detailed and helpful post about time format customization...
    I am looking for a custom formating which, when I enter a decimal number, just show it as time.
    Want to change decimal point (.) to colon ( : )
    For example if I enter 11.39, I want it to show in cell as 11:39.
    Is it possible???

  27. hello i would like to ask. in my excel, the date is put as General format. example: 202302 which stands for 2023/02. so how can i format it to 2023/02 since i need to calculate the remaining months between 202302 and 202501 as well. hence i would like to ask on answer for this. thanks a lot!

  28. Hi,

    My excel won't do any format of the date I have entered.
    I entered 01-2022 and want to format to jan-22, but nothing happened. Also tried other formats, still didn't change at all. It used to do it correctly, but now nothing happened.
    How can I fix this?

  29. Thank you, this was helpful!

  30. Is there a way to change the how the date displays based on the value of the cell? I haven't seen this option in conditional formatting. What I want to do is display all dates in months except for May, June, and July as mmm. d (ex. Jan. 1, Feb. 7, Dec. 31, etc) and then the May, June, and July dates to be spelled out without a period (May 31, June 6, July 16). Is there a way to do this directly in the cell so I can just enter it as 6/1/22 and it get formatted as June 1 or (in the same cell) enter it as 8/31/22 and it get formatted to Aug. 31?

    I figure I could use a helper column with an if function maybe, but it would be better if I could get the settings to work directly. Thanks!

  31. I am trying to extract time from a text in cell A1 for example
    (Cell A1) Smith, John Lunch 03:02 (where 03:02 is 3 mins and 2 secs and the output should be 00:03:02) . Appreciate your help.

  32. I want to change datetime format to Date format like 30 May 2022 11:15:00:000 to 30-05-2022. How i can achieve this? Experts input pls. Thanks in advance.

  33. Is there a way to change the day hours?
    I want to define a day between 10:00 - 18:00 to calculate the working hours correctly.
    How can I apply this change to Excel?

  34. Hi Alexander,
    I actually couldnt find the following problem any where if i try to look it up.
    I am trying to format the cells to change an input of (for example) 11 to 11:00.
    But when i set the cellformat to -Time- it changes the value to 11-01-1900 00:00:00.

    Even when using custom formatting to (hh:mm) it still converts the 11 into a date and time.
    Is there a way where i can input an absolute number ranging from 0 to 72 and have excel convert is to a hh:mm format?

    Thanks a million.

  35. Hi Alexander,

    I am getting error value with DATEVALUE(06/12/2022). Can you please suggest me.

    Thanks

  36. How do I change this format mmddyyy to this format ddmmyyyy?

  37. I want to change this format 02.11.2022
    into 2022-11-02

    • =DTAE(RIGHT(A1,4),MID(A1,4,2),LEFT(A1,2))

  38. Dear Team
    How can I convert following time format through a formula 3 hr. 21 min. into 3:21 format.
    Thanks in advance

  39. Hi guys, is it possible to change date and time format to days?
    e.g.

    from:
    25/10/2022 0:00
    to:
    Day 1

    and

    from:
    26/10/2022 0:00
    to:
    Day 2

    Thanks

  40. Hey Alexander! Thank you for all the nice reply for people! I am Sure you do a lot of good!

    I have a problem when trying to import CSV into excel as numbers that are displayed is not the same as in the console. This is an issue as I need the number-value, but the console shows a long-date with clock aswell.

    For an example:
    Value: Console:
    880 is 05/02/1900 16.00.00
    1077 is 13/02/1900 21.00.00
    1104 is 15/02/1900 00.00.00
    2000 is 23/03/1900 08.00.00
    Etc. Etc.

    I want to get the values and stop it from avoiding giving me what's in the console. What is the issue here excactly and how do I bypass this? I tried with a xlookup, datevalue and so forth, but nothing works! It is like the numbers printed are belived to be long-date format with time. I need the Value-data as shown above, and I need some kind of formular who can convert the console-values displayed to the right above, to the values displayed to the left above.

    Appreciate your help!

  41. How about converting this date format (when pasting from another spreadsheet) - 2022-04-13 09:58:14
    I would like it to simply be short date mm/dd/yyyy, no matter how I format the cells before I paste, I always get this silly format. I don't want to have to use text to columns every time. Is it possible? It is this format in like 3 columns worth of data for all my lines. I need to be able to update this report swiftly.

  42. Dear sir

    convert date format from 29/07/1979 to date format 10.11.2021

  43. Hi Sir,
    Need your help to provide me a formula to change below date & time which is combined as number

    20220804090848 (yyyymmddHHmmss)

    I need it as, dd/mm/yyyy HH:mm:ss

    Thanks.

  44. how to change whole culom with 22/09/2022 00:00 to 09/09/2022 in excel please?

  45. Hi i have text format like this 2007-May-24 00:00:0000. How can i convert this into date and time format as this 24-05-07 00:00 ? Please help

  46. Hi! Newer to excel and need help to save time please!
    In one column I've entered times (about 500+rows) like this: 2105 (as in 21:05). Unfortunately, at the time creating the sheet, I did not have the knowledge or wherewithal to change the format of the column to the 24 hr format (hh:mm) and I only kept it in plain number format. So, my problem is I don't want to go and correct all 500+ entries individually. Is there a formula I can use to switch 2105 to 21:05 (plain number format to time format)?? Please? Help?

  47. Hi, I have a CSV file containing a column with IDs formatted as [1-1-1234] but Excel keeps changing it to the date format [m/d/yyyy]. I'm not able to import my data unless they're done with the dashes (-).

    I've done the custom format to change it to [m-d-yyyy] but since it's a CSV file it doesn't save the formatting. Is there a way to change/create the default date format to have dashes (-) instead of slashes (/)?

    Thank you!

    • Hello!
      Pay attention to the following paragraph of the article above – How to change the default date and time formats in Excel. Change the date format as you need in the Region and Language panel.

  48. 22//06//2022 10:52 PM
    I want change the format of Above like 22//06//2022 21:52

  49. I looked through all of your examples several times so I am sorry if I missed the answer to my question....I am trying to change the date to 09-07-2001 from 09/07/2001. I need the mm-dd-yyyy format created but everything I am finding puts it dd/mm/yyyy

    Thanks for your help

    • Hi!
      Pay attention to the following paragraph of the article above - Creating a custom date format in Excel. Write the date format you want in the Type box.

  50. I am trying to convert these numbers 154975.4857, & 145454.2432 from a csv file to minutes and seconds.

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)