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!

917 comments

  1. I have date written in the format 20181019 and i need to re-write them using slash, that is 2018/10/19.
    Approximately there are 20k of these dates i need to change. How can i do this. Thanks

  2. Hii
    I have multiple dates like 15/03/2020 in a SINGLE CELL but i want to change the date format as 2020-03-15
    Note:- in a single cell multiple dates to be change!!

  3. Hi, I've got exported data into excel and unfortunately they have the date in this text format "May 17, 2022" in the D column, and while I've been through the comments I can't find anything that converts this into a date. What would you recommend?

    Thanks

      • Thank you for replying. Unfortunately this returns a #VALUE

        • Hi!
          Perhaps the problem is in the regional settings of your Windows. Try this formula

          =DATE(RIGHT(D1,4),VLOOKUP(LEFT(D1,3), {"JAN",1;"FEB",2;"MAR",3;"APR",4;"May",5;"JUN",6;"JUL",7;"AUG",8;"Sep",9;"OCT",10;"NOV",11;"DEC",12},2,0),MID(D1,5,2))

          You can also analyze more than 500 combinations representing dates in text format and convert them to regular Excel dates using Convert Text to Date tool. It is available as a part of our Ultimate Suite for Excel that you can install in a trial mode and check how it works for free.

  4. Hi there,

    I have hundreds of dates in a column. In this column, some dates are dd/mm/yyyy and some are mm/dd/yyyy. I am from New Zealand and require the dd/mm/yyyy format. I have tried to change the format settings of the entire column to do this.

    At first, some rows were set as Armenian, and some set as English. After setting them all to English, the problem is still happening. I tried to read through most of your advice and comment replies but I got a wee bit confused and thought it best to just ask!

    • Hello!
      Some of your dates are written as text. This text should be converted to a date. Set the cells to the desired date format and use the formula:

      =IF(ISTEXT(A1),DATE(RIGHT(A1,4),LEFT(A1,SEARCH("/",A1)-1),MID(A1,SEARCH("/",A1)+1,SEARCH("/",A1,4)-SEARCH("/",A1)-1)),A1)

      I recommend reading this guide: How to convert text to date in Excel

  5. My hundreds of dates are entered with an abbreviation at the end of the day i.e. 22nd March 2022 and it hasn't accepted any of the normal ways of changing the format to 22/03/2022 - I know the 'nd' is causing the problem but can't figure my way around it - any help?

    • Hello!
      Remove extra characters from text and convert to date using DATEVALUE function:

      =DATEVALUE(LEFT(A1,SEARCH(" ",A1)-3)&MID(A1,SEARCH(" ",A1),30))

      Set the date format you need in the cell as described in the article above.

      • Thank you SOOOOO MUCH it worked a treat and has saved me so much time :)

  6. Difference between two dates with time to collect time difference between two dates for example Wed Apr 20 17:56:16 IST 2022 & Wed Apr 20 17:53:43 IST 2022 Please give answer with formula not manually because I have 30000 entries for work. Please help if any

  7. Excel stopped recognizing the Spanish date formats, it was working from January til March then it just stopped working during April.

    Example:
    Using VLOOKUP and 01 abr. as a reference, it doesn't count "01 abr" from the raw data.

    This worked from Jan to Mar using the same "everything". I just changed the month.

  8. Insanely simple, thank you

  9. I want to input 20032022 then excel will convert it to 20-Mar-2022. what is the custom format for that?

  10. how can Jan-2021 be read as January 2021 instead of being a text

  11. how to change 02.01.2022 to 02/01/2022?

  12. Monday, February 21, 2022
    CONVERT IN 02-21-2022
    FORMULA USING TEXT(RIGHT(N1044,LEN(N1044)-FIND(",",N1044)-1),"mm-dd-yyyy")
    BUT AFTER RESULT February 21, 2022
    I NEED CONVERT IN 02-21-2022

  13. I have date in format Feb-21, Mar-21 & so on till Jan-22. While converting this to year I am not able to do that, I am using formula Year it shows me a result 2022 for 2021 as well. Also, I am not able to convert it to date. Please help.

    • Hello!
      Look closely at what date format is set in the cell. To do this, press CTRL+1. I think your date format is "mmm-dd".
      Feb-21 means 21 February 2022.

  14. Hi, I use mmmm or dddd and I get always fmonth or day names in small letters, but I would like that first letter is big just like Thursday but i get thursday. I use estonian language and may bet that is reason why all letters.

    • Hello!
      Pay attention to what custom date format is set in this cell. If there is something like
      [$-F419]dddd, d mmmm yyyy
      then delete the regional settings [$-F419].
      I hope it’ll be helpful. If something is still unclear, please feel free to ask.

      • Hello! and thank you for your replay but my problem are that all months and days of the week are in lower case (small letter). I put 1.04.2022 and Format Cells>NUmber>Custom I put mmmm because I would like to see only month or some other place weekday and result always I get april or monday not what i want April or Monday . I would like to see that first letter is big /upper. If I use formula =upper(a1) then all letters will be APRIL but I want that first letter is only upper

        • That formula and 1.04.2022 will be Aprill

          =UPPER(LEFT(TEXT(A1;"mmmm");1))&""&LOWER(RIGHT(TEXT(A1;"mmmm");LEN(TEXT(A1;"mmmm"))-1))

          but is there a simpler method

  15. Is there a way to save custom formatting to a named option in the Date list

  16. Hello, I need to change a bunch of dates formatted like this: 2021-10-02, 1:47:40 PST
    to 10/02/2021. What formula can I use? Thanks.

  17. So i have a question if my date format reads as 01/02/2022 = Jan 2,2022 which is wrong because the month should be February is the a formular to correct such ?

  18. Hi - thank you for this very nice article :-)

    I am puzzled by this observation in my company: If I create a new workbook and enter in the same date (I type it in as "dd/mm") in three different cells and then;
    1: do nothing
    2: specify a custom format "dd-mm-yyyy" (typical Danish format)
    3: specify a custom format "mm/dd/yyyy" (typical US format)

    Then my first question is: why does the first cell display as "dd-mmm"? Or rather - why is the default cell format for date entries a custom format of "dd-mmm". Shouldn't it rather be the deafult Windows regional settings format ? If I want to change it, so going forward then my new spreadsheets just use the default Windows format - how can I do that.

    Secondly : when I send this spreadsheet by e-mail to a colleague in the US, then the date in the second cell (Danish format) is changed so it appears the same as in cell 3 (the US format). If I go to the trouble of enforcing a specific / custom format, then I would have assumed that this would be respected, even if it is send to another Excel user. Why is this not the case and is there anything I can do to enforce a particular date format, without having to actually enter in dates as text (or use formuals and stuff)?

    Br,
    Kim

    • First questions:
      "Shouldn't it rather be the deafult Windows regional settings format?"
      There is no date format in windows regional settings, OOXML standard nor ISO 8601 formats without the year specified, so it seems to be a free interpretation/guess from excel where it transforms it to a date (with current year) but display just the information provided. I didn't fint documentation about it.

      "... how can I do that."
      If you add the year (at least yy) to the date, then it generally autoformats to your short date format regional setting. I didn't find a way for auto-transforming dd/mm to short date regional format though.

      Second questions:
      "... is there anything I can do to enforce a particular date format?"
      Add ";@" at the end, for example: "dd-mm-yyyy;@"

      "¿Why is this not the case...?"
      There is a list of number formats which their corresponding format code can change depending on the format settings of your operative system. Some, but not all, of these format codes are the ones with * mentioned in this article as Default date format; and "dd-mm-yyyy" with your regional settings is another one.
      When you use a format code that matches one of these format codes, excel saves its Id (numFmtId) but not the actual formatCode that your excel is displaying. So, when reading the file with another regional settings, excel could interpret it with a different formatCode.
      If your regional setting for short date is "dd-MM-yyyy" (default for Danish-Denmark), then the excel formatCode "dd-mm-yyyy" is associated with numFmtId 14 and it saves just that Id. When your friend opens the file, excel would interpret the numFmtId 14 according to his format settings (which should be m/d/yyyy for English-USA).

      https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.numberingformat

  19. Pls am having a problem with a date column. Some entries are showing datetime including PM and AM while others only show dates, but when I click on them it appears as both the date, time and PM on the formula tab. Pls how can i display just the dates. I don't need the time nor the PM or AM

  20. Hi,

    I want to update the format of ONLY date values from particular column which has all types of data values.

    Thanks,
    Riyaz

  21. I am past some 1-2,2-4...like this it will show 1-feb-2021,2-Apr-2021 how can slove entire cell one time pls give mee reply

  22. Hi
    I find a way to convert Gregorian date to another (e.g. persian calender) format, but what about if I want to convert persian calender into Gregorian (or other formats)??

  23. Hello, I am going crazy here... I am using Excel in a MacBook Pro, version 16.56. My problem is the following: I have a data table where in the first column I register a list of dates by the exact day when a sale has occurred and in the next column I register the amount of that sale. Now I want to create a bar chart that groups all these dates into months to show me the 12 totals of the monthly sales throughout the year, where the x-axis is the 12 months of the year, and the y-axis is the amount of the sales. Now, once I want to label the bar charts, instead of getting the total sales amount for a specific month, I get a label for each date of each sale. Basically the bar is composed of many bars stacked one on top of the other for each date, instead of being just the sum of the sales for that specific months as it should be. The result is I cannot get a label with the total monthly sales amount, by I get numerous labels inside the monthly bar chart labelling the amount of the sale for each date where that sale has occurred. Please somebody help me!

      • Thank you, ok understood, I feared that, although it surprises me such a task is not performed by excel without having to do extra work to group the sales by month as well ;(

  24. dd-mm-yyyy hh:mm i want this date format in my all workbooks.. is there any way to set his globally ?

    • Hello!
      The short and long date formats are retrieved from Windows Regional Settings. Open Windows Settings - Time & Language - Region - Change Data formats

  25. 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

  26. 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

  27. 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!

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

  28. 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?

      • 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

  29. 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.

  30. 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

  31. 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"),"")

    • 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.

  32. 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.....

  33. 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

  34. 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?

    • 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),".",":")

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

        • 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.

          • 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.

            • 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.

              • 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

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

              • 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?

              • 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.

              • Thank you for the time and effort Alex.

  35. 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.

    • 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.

      • Thanks a lot. I tried the same.

  36. 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!!

  37. Hi there,

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

  38. 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

  39. Can someone help me to extract time from

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

  40. 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

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

  42. 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.

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

  44. 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!

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

    • 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.

  46. 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

  47. 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

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

      • 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

  48. 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

  49. Hello,

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

    Thanks

  50. 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

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