Comments on: 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. Continue reading

Comments page 7. Total comments: 936

  1. How would I go about formatting a column that has the information in years as dates. Since it is currently in the general number format I am unable to insert a timeline slicer. I have tried using the custom yyyy date but it converts all the dates to 1905

  2. How to keep the same format date of excel in CSV file?
    Because, when I converting a file from excel to CSV format. I noted some of the dates have changed from MM/DD/YYYY into DD/MM/YYYY. I wanted to keep the same data as MM/DD/YYYY.
    Appreciate your help. Thank you

    1. Hello!
      CSV is a plain text file. No formats are possible there. Try changing the system date format before converting.

  3. Hi! Could you please help us on how will we able to change the format from this day "Thu Oct 28 09:42:08 PDT 2021" to "MM/DD/YYYY" format only

    Appreciate your help!

    1. Hello!
      All recommendations on how to change the date format are described above in this article. If your date is written as text, then I recommend this guide: Convert text to date in Excel.
      Please try the following formula:

      =DATEVALUE(MONTH(1&MID(A1,5,3))&"-"&MID(A1,9,2)&"-"&RIGHT(A1,4))

  4. I could get what I want by dividing 365.25 by 12 then dividing the difference of the dates by the result of the division. Any other better way?

      1. I have an issue to replace date of day to start day of every date "Example" 19/4/2021 - 24/1/2021 - 27/8/2021 need to be change date of every example to be 1/4/2021 - 1/1/2021 - 1/8/2021 " is there any formula please to change the day of the date?

        Thanks for your support

  5. Hello, Please help,
    I want to calculate age in months and not in years between two dates, for example 15/01/2020 23/11/2021 1.86 years =(B1-A1)/365.25, this formula is used to calculate age in years. But I want the age to be in months and with two decimal places.

  6. I have some dates in this format. 13-01-1992. I want to be able to change to yyyy-mm-dd format in excel. I have tried changing from the format cells/custom format. but it does not seem to change. is there any formula you might know that can change ?
    thanks in advance

    1. Hello!
      I'm assuming your dates are written as text. Use these guidelines to convert this text to a date.
      I hope I answered your question. If you have any other questions, please don’t hesitate to ask.

  7. I have been able to pull the day (as text) from a date in another field (ex: 27 from 27 Sep 21) using TEXT(DAY(cell),"00").
    However, for my application, I would also like to be able to add another number to the day portion for scheduling purposes. For example, a single schedule for 27 Sep 21 would show as "727", but I would like to add 30 or 60 to show other scheduled activity for that day (to be shown as "757" and "787" respectively).
    What is the best way to accomplish this?
    The original formula is: If(MONTH(A36)=9,"7"&TEXT(DAY(A36),"00"),"")

    1. Hello!
      You can simply add 30 to your formula.

      =IF(MONTH(A36)=9,"7"&TEXT(DAY(A36),"00"),"")+30

      If the result is as text -

      =(IF(MONTH(A36)=9,"7"&TEXT(DAY(A36),"00"),"")+30)&""

      Hope this is what you need.

  8. one cell Take 7 Numeric Value For example (1112021). How to change Date formate.
    but which date is correct its (01-11-2021) or (11-01-2021) ?

    Pls Kindly send formula.....

  9. Hi sir,

    need your support to change the date format as below pasted date format not correct and not complete.

    09/17/21 15:53:42

    i want like 17/09-2021 15:53:42

    1. Hi!
      I hope you have studied the recommendations in the tutorial above. Replace in date format symbol / on -.

  10. Hi, How to convert 01-JUN-18 12.25.13.031000000 AM into 00:25:13 as the string is in AM. Also, how I convert the same string to time format in PM i.e. 12:25:13. Can someone help me with a formula with AM and PM?

    1. Hi!
      If I understand your task correctly, the following formula should work for you:

      =LEFT(A2,SEARCH(" ",A2,1)) + SUBSTITUTE(LEFT(SUBSTITUTE(MID(A2,SEARCH(" ",A2,1)+1,100),".","#",3), SEARCH("#",SUBSTITUTE(MID(A2,SEARCH(" ",A2,1)+1,100),".","#",3),1)-1) & RIGHT(A2,3),".",":")

      1. I will try the formula and update. Thanks Already.

        1. Hi Alex,

          I applied the formula. It gives correct time. But when I compare to 12:25:10 AM i.e. 01-JUN-18 12.25.10.031000000 AM it gives a difference of 23:59:57 which is too huge difference to consider.

          I tried with another formula before:

          =(SUBSTITUTE(MID(A2,11,8),”.”,”:”)+IF(AND(MID(A2,11,2)”12”,RIGHT (A2,2)=“PM”),0.5,0))+TIME (4,0,0)

          The difference from other timestamps are good. Like for above example, I get 00:00:03.

          Only, issue is with the formula is, it doesn’t identify 12:00:00 AM as 00:00:00 but identifies 12:00:00 PM as 12:00:00.so, I requested for a suggestion. Any update on the details would be helpful. Thanks already.

          1. Hello!
            12:00 am and 12:00 pm are shown differently in different countries. Excel defines 12:00:00 PM as 12:00:00 according to the international standard ISO 8601.

            1. I am trying to find difference between

              21-08-24 03:02:54 and 24-AUG-21 03.00.47.059641000AM. I have added time(4,0,0).

              I converted as 7:02:54 AM and 7:00:47 AM. When I subtract as per the above formula, it gives a difference of 23:57:53.

              When I convert the timestamps to number, it is 0.29 and 44432.29. I believe, the second number is counting the date also, that’s why making difference too huge. How can I resolve this? As difference should show as 0:02:07. Please suggest.

              1. Thank you for the time and effort Alex.

              2. To convert the 24-AUG-21 03.00.47.059641000AM, I have applied
                =LEFT(A2,SEARCH(" ",A2,1)) + SUBSTITUTE(LEFT(SUBSTITUTE(MID(A2,SEARCH(" ",A2,1)+1,100),".","#",3), SEARCH("#",SUBSTITUTE(MID(A2,SEARCH(" ",A2,1)+1,100),".","#",3),1)-1) & RIGHT(A2,3),".",":")

                Then for difference, I have applied =MAX(A2::B2)-MIN(A2:B2)

                Some, results for other timestamps are correct but some shows huge difference like above. How I can rectify this issue?

              3. Hi!
                If the formula shows the correct result for some data, then the formula is correct. I think that in some cells the data is written differently. Therefore, the result is wrong. Check the data. I can't help you anymore.

              4. No, both are 24 aug 2021. It’s just formats are different. I am subtracting 07:02:54 - 07:00:47.

              5. Hi!
                Explain what you are subtracting and what formula you are using. You cannot subtract 7:02:54 AM from 7:00:47 AM. Negative times are not possible. If from date 8/24/2021 3:00:47 subtract 8/21/2024 3:02:54 we get 2 days 23:57:53

  11. I am working with three timestamps:
    021928.000000, 21-09-02 02:39:51, 21-08-31 22:40:00. Converted to
    2:19:28 AM, 2:39:51 AM & 22:40:00 AM. Last timestamp is added 4 hours.

    Consecutive timestamp difference from the array is.
    0:20:23, 0:00:09.

    To find the max time difference , I have applied the formula in conditional formatting rule:

    =Q2=MAX($Q2:$S2).

    It doesn’t give 0:20:23 as max value but the value returns is 0:00:09.

    Please advise, if anything needs to be understood to improve the formula.

    1. Hello!
      You don't need to use a formula to highlight the maximum value. Use Conditional Formatting - Top/Bottom Rules - Top 10 Items - Format cells rank in the top set to 1.
      I hope this will help.

      1. Thanks a lot. I tried the same.

  12. Hello,

    I wanted to learn, how to convert "3 year(s), 10 month(s), 29 day(s)" into numbers like "3.8" or "4.1". Thank you!!

  13. Hi there,

    What is the excel formula for "07/2021 to 06/2022" in excel?

  14. There is a long list of date in this format 26-07-2021 11:39:00 AM, but when i convert them to date 26-07-202, few get converted but few are still in the same format

    Want to convert 26-07-2021 11:39:00 AM to 26-07-2021

    Can you share, how can that be done

  15. Can someone help me to extract time from

    30-jun-21 01.45.18.488173000 pm. to 01:45:18pm?

  16. Hi,
    I combined 2 excel files with dates in the formats "2021-07-28 13:00:00" and "8/18/21 10:00 AM".

    Using custom formatting, I changed all the dates to "2021-07-28 13:00:00" format. However, when I did a pivot chart on the table, I realized that the dates appeared in both formats.

    How do correct this so that all the dates appear in the format "2021-07-28 13:00:00".

    Thanks

  17. How convert this type value 20191115 to 15/11/2019

  18. The dates in my Google drive Excel file are confusing dates for months. Instead of 03 / 08 / 2021 reading as 3rd August, it's reading as 8th March. There are so many entries having similar issues, how do I correct this error without having to do the one after the other. So that it recognizes the month as day instead.
    Thank you.

  19. Which ever date i enter, it should appear as the 1st date of that month

  20. Hello all,

    May I ask how can I show my date like: 9-Aug-2021, with the input message by me be: 8/9/2021 please? Because if I input it that way (with month first, then date), it turns out like: 8-Sept-2021

    Thank you so much in advance!

  21. How can I convert from 7/14/2021 to 7/14 ?

    1. Define the column as DAte data type
      Apply custom format: M/d

      The underlying date will contain the year but it will not be displayed.

  22. That should have read day, date, month and year!

    Thanks

    Louise

    Louise says:
    August 5, 2021 at 4:11 am
    I would like all the day , date and year in the following format

    Mon, 23 Jan, 2021

    Is there anyway to do this in excel?

    Thanks

    Louise

  23. I would like all the day , date and year in the following format

    Mon, 23 Jan, 2021

    Is there anyway to do this in excel?

    Thanks

    Louise

    1. Hi!
      I hope you have studied the recommendations in the tutorial above. It contains answers to your question — ddd, dd mmm, yyyy

      1. Define the column as a Date data type in Home tab > Number group

        alternately
        ddd, d mmm, yyyy

        Single D does not display leading zero

        Alexander's format would display date

        Mon, 03 Jan, 2021

  24. Within a cell, I've been trying to suss out how to colour the day name differently from the date (in a lighter grey shade) to help the date stand out but keeping the day visible as it will jog the user's memory for the delivery they're checking.
    I know it's possible to change font colour between positive and negative numeric values and conditional formatting can be used to pick out different cell values in different colours but I can't find a format syntax to colour part cells.
    If you know of a way to use custom formats to colour different parts of a font string I'd be interested to hear. Just curious, don't expect there's many people want to do that!
    Until I find a better way I have duplicated the date column - one has the ddd format with grey font and the other column has the dd/mmm/yy format with black font.
    thanks

  25. Hello,

    How can i convert from July 24th 2021 to 24-07-2021

    Thanks

  26. How would I go about doing the opposite?
    e.g.

    from:
    25/09/2019 14:00:03.000
    to:
    2019-09-25T14:00:03.000Z

    Thanks again

      1. Yeah, I realized just after posting that, for doing it the other way around, it was easier to simply create a custom format that includes the T and Z in the required places.

        Thanks again

  27. Hi,
    How would formula would I need to convert the following time stamp formats?:

    from:
    2019-09-25T14:00:03.000Z
    to:
    25/09/2019 14:00:03.000

    Many thanks

      1. Thank you!

  28. hi,
    i want to insert serial wise numbers for particular month placed orders?
    Such as 21-year,07-month,and in that month placed orders one by one.

    i got upto (yy,mm PR). I want that to be in order like 210701 PR,210702 PR,210703 PR,210704 PR,210705 PR.

    Please help me out

  29. I have the issue that when I copy a BOM from another program I have certain numbers with the format "1.1.1" which are converted to "01.01.2001". This is fine when I copy them as I make sure they are formatted as text first.

    My problem however is this other program sometimes writes them as "1,1,1" with commas instead of full stops. Don't ask me why this happens. I copy and paste over like normal and use the find replace feature to change the commas to full stops. This is where Excel then decides to change the format back to standard and overwrite all my "1.1.1"s as "01.01.2001". When I then attempt to convert back to text it gives me the 1900 text of that date which is unwanted.

    How do I use find and Replace to change my commas to full stops without Excel reading it as dates? There are format options in the Find and Replace feature but when you use it I see it uses standard first and then converts to text for example. So I will quickly see a flash of "01.01.2001" and then it will turn into the 1900 text.

    Is there a way to Stop Excel reading "1.1.1" as a date and only use "1/1/1" for example?

      1. Sorry but as I said this doesn't work as the Find and Replace function overwrites this. Even when I set the desired format with the Find and Replace function I see that it converts with Standard format and overwrites as text afterwards, giving me a date as 1900 text.

          1. My process is:

            Format column as text
            Copy BOM into column (formatted with commas "1,1,1")
            Highlight column and Find and Replace all commas with full stops.
            Find and Replace changes these to Dates

            When I click on options in Find and Replace to format as text it formats first to dates and then as 1900 text so I end up with 443829 instead of the "1.1.1" that I want.

  30. Dear Sir,

    I need to keep type in my excel date as 02 AUGUST 2021. Month has to be full block letters (capital letters). please help

    1. Hello!
      This is only possible when converting date to text.

      =TEXT(A1,"dd")&" "&UPPER(TEXT(A1,"mmmm"))&" "&YEAR(A1)

  31. Hi, How to change 2-Feb format to 2/2/2010 in excel?

  32. I am trying to edit a document that has the dates listed all in the format of year date month...
    example: 19612404.
    I need the dates to read as 12/04/1961
    Month/Date/ year. Each date month year will be different for the column entries so I am struggling to do a formula for it. Any help thanks

  33. Hi, my excel sheet showing some parts serial number like this 2.40373551027723E+21, it should be a number. i tried to format to number and insert single quote(') in front. but still the same. is there is any way to correct this?

    1. Hi!
      When writing a number with more than 15 digits to a cell in an Excel document, the last digits are replaced with zeros. This problem occurs because Excel has a maximum precision of 15 digits. When writing a long number to a cell, the number is rounded to 15 digits and the number is presented in exponential form. You cannot increase the precision of the representation of numbers in Excel.
      Write long numbers like text. When entering the number, precede the number with a single quotation mark.

  34. Bonjour,

    J'aimerais que lorsque de j'écris jj-mm-aa, il me donne automatiquement jj-mmm-aaaa.
    Par exemple si 03-06-20 j'aimerais qu'il me donne 3 Jun 2020.

    Comment faire?

    Merci

    1. Hello!
      Set a custom date format in the cell

      jj-mmm-aaaa

      I kindly ask you to have a closer look at the article above

  35. I thouted days format was changed ,Tuesday after Thursday, but Wednesday wronged to mention.

  36. Please don't tell me that I only have one solution:

    =DATE(year, month, day)

    =DATE(RIGHT(A1,4),LEFT(A1,2),MID(A1,3,2))

    WRITE in a "SOURCE DATA" column as "text" : 05242021

    My Date column will be identical. Lol.

    If so, let's please tell Microsoft... Um... mmddyyyy is an OK format. :)

  37. Alexander,

    I have searched and done my due diligence to find my answer. Not knowing the answer, I probably am not recognizing that it is in this thread or one of the referenced "Already Answered" threads.

    I like to type the date as mmddyyyy, e.g. 05242021 ... It involves typing 3 fewer symbols... I changed format to mmddyyyy, but that is if I type a date format that Excel recognizes... BUT, I want to type in the mmddyyyy format and have Excel recognize that as a date.

    How? Please. Thank You.

    Cheers, Rick.

    1. Found it, I hope! :) Thanks

      Yes, choose the Format Cells command, select Custom from the Category listbox, and type ##"/"##"/"#### into the Type textbox.

      1. Hi!
        I was unable to replicate your format. However, if this works for you, then you are not recording the date, but the delimited text.

      2. So, close, yet so far... Not my exact solution... Excel wont quite recognize it as a date!

  38. Thank you, cant wait to try it

  39. Hi

    I'm not sure if my request is possible, but I would like to calculate the time difference for a date and time format used within the military. The format used in our Defence Force is 'dd/hh:mm/mmm/yy', displayed/written as '121300Apr21' (24hr). My questions are;
    1. Is it possible for excel to recognise this date/time format, including the month as text?
    2. If so, what formula would I use to calculate the time difference between two dates of this format? Eg - calculate time between 121300May21 and 131730May21

    3. Finally, is it possible for excel to recognise this date and time format displayed in a number of different ways, i.e, with, or without spaces, between the date and time figures from the same spreadsheet list? The list contains dates and times with spaces in following examples;
    a. 12 1300 May 21
    b. 121300 May 21
    c. 12 1300May 21

    Q1&2 are the essential answers I require. Q3, is a nice to have as it will save me time in re-writing a few thousand dates/times already entered. If Q3 is not achievable, then these calculations will be applied from the current date, assuming that Q1&2 are possible.

    Appreciate any assistance, and happy to provide clarity if my questions are confusing - thanks

    1. Hello!
      Excel recognizes your data as text. You can convert this text to date and time using this fromula

      =--(LEFT(A1,2)&"-"&MID(A1,7,3)&"-"&RIGHT(A1,2))+TIME(MID(A1,3,2),MID(A1,5,2),0)

      Apply the date and time format you want to this cell.
      You can change this formula to convert any date from Q3.
      You can convert 121300May21 and 131730May21 in two separate cells and then subtract them. Or use one formula

      =--(LEFT(A2,2)&"-"&MID(A2,7,3)&"-"&RIGHT(A2,2))+TIME(MID(A2,3,2),MID(A2,5,2),0) - (--(LEFT(A1,2)&"-"&MID(A1,7,3)&"-"&RIGHT(A1,2))+TIME(MID(A1,3,2),MID(A1,5,2),0))

  40. My problem is here:

    I am used to typing dates as mm-dd-yy

    When I type in a cell 08-12-21, I want it to be (dd-mmm-yy) which is 12-Aug-21

    But what shows up is 8-Dec-21.

    How do I fix this?

  41. hi sir, i type 4/10 it is automatically changed to Apr-10. I need as it is (4/10).. How can i get it?????

    1. Hello!
      To write a fraction in a cell that has the General format, precede the fraction with zero and a space. For example, to enter 4/10 into a cell, you would type 0 4/10. If you enter 4/10, Excel converts that fraction to a date.

  42. hello, how to change the time format using an excel function, example, converting this format (12:00 AM/PM) to (12-00-00 AM/PM), (12:00:00 AM/PM), (12 AM/PM) thanks

    1. Hello!
      I hope you have studied the recommendations in the tutorial above.
      Use custom time format:

      h:mm:ss AM/PM
      hh AM/PM
      h-mm-ss AM/PM

      1. Hello thanks for the response. I have another question, can you change the format of time using the example problem above by creating an excel function and not by create custom format?

  43. How to change date format from "2020-Apr-27 " to 27-Apr-2020 in excel file

    1. Hello!
      Please check out this article to learn how to convert text to date and number to date.
      I can’t give you a more accurate advice since you didn’t specify which date and time format your Windows uses.

  44. Good day, I have this date formats 13/05/2020, 12/5/2020 in a workbook and I am unable to format the sheet.

    Any Help?

    Thanks

  45. Hello,
    I spend 99% of my Excel time processing timestamped data from SQL Server which include milliseconds.
    My custom Excel format is: yyyy-mm-dd hh:mm:ss.000
    And it works perfectly but I always have to apply the formatting manually to cells in each sheet and then use format painter to change the other columns.
    I would like to setup Excel so that every time Excel wants to format any cell as any kind of date or time I want Excel to use my custom format, including ms.
    I tried using my Excel format string in Windows regional settings but the .000 for milliseconds is not accepted.
    Is this possible? and if so how?
    Thanks

    1. Hello!
      Unfortunately, the default date and time format in Windows does not use milliseconds. This can be done using a custom format.

  46. Thanks for reply.
    From the list of excel, I used the DOB to find t a person on database system that only dd.mm.yyyy format. So I copy it tang paste on format back to dd/mm/yyyy.

    Regards,

  47. It's works- well done but when I want to copy its came back to dd/dd/yyyy
    thanks

    1. Hi Gufron,

      Since format is applied to cells, not values, you also need to set your custom date format to the cells that you copy the dates to.

  48. It's works- well done.
    thanks

  49. Greeting,

    How to change date format 08/04/2021 into 08.04.2021

    Thanks

  50. Hi! My problem is when I type "Apr 3" in excel and click enter, the date that appears is April 1, 2001. The cell is formatted for the date to appear that way but the actual date that comes out is not April 3, 2021. This is happening on my laptop where I just installed Microsoft Windows 10.

    In my PC, that has Microsoft Windows 10, I do not have this problem with excel. I can type in Apr 3 and April 3, 2021 appears. Please help me solve this issue? Thank you

    1. Hi!
      I recommend checking the regional settings of Windows: Control Panel - Time&Language - Region - Regional format data.

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 :)