Excel time format: 12/24 hour, custom, default

This tutorial explains the basics and beyond of the Excel time format.

Microsoft Excel has a handful of time features and knowing them in depth can save you a lot of time. To leverage powerful time functions, it helps to know how Excel stores times. In this article, you will find everything you need to know about formatting time in Excel:

Excel time format

If you have been following our Excel Date Format tutorial, you know that Microsoft Excel stores dates as sequential numbers beginning with January 1, 1900, which is stored as number 1. As time is a portion of a day, times are stored as decimal fractions.

In Excel's internal system:

  • 00:00:00 is stored as 0.0
  • 23:59:59 is stored as 0.99999
  • 06:00 AM is 0.25
  • 12:00 PM is 0.5

When both date and time are entered in a cell, the value is stored as a decimal number comprised of an integer representing the date and a decimal portion representing the time. For example, 1 June 2025 9:30 AM is stored as 45809.39583. Time formatting in Excel

How to get a decimal number representing time in Excel

To get a decimal number representing a certain time, carry out these steps:

  1. Select a cell containing the time.
  2. Press Ctrl + 1 to open the Format Cells dialog box.
  3. On the Number tab, select General under Category, and you will see the decimal in the Sample box.

Now, you can write down that number and click Cancel to close the window. Or, you can click the OK button and have the time replaced with a corresponding decimal number in the cell. Get a decimal number representing the time in Excel.

To keep both the original time and its decimal representation, enter a simple formula like =B3 (where B3 is the time value) in any empty cell, and set the General number format for that cell. Return a decimal number representing the time in a separate cell.

This is the fastest way to convert time to decimal in Excel. You can also use different formulas to convert time to hours, minutes or seconds.

How to format time in Excel

Microsoft Excel is smart enough to recognize a time value as you type it in a cell. For example, if you type 20:30, or 8:30 PM, or even 8:30 p, Excel will interpret this as a time and display either 20:30 or 8:30 PM, depending on your default time format.

To change an existing time formatting or apply some specific one, use the Format Cells dialog as described below.

  1. Select the cell(s) that you want to format.
  2. Press Ctrl + 1 to open the Format Cells dialog.
  3. On the Number tab, select Time from the Category list, and then choose the desired format from the Type list.
  4. Click OK to apply the selected format and close the dialog box. Apply or change the time format in Excel.

Custom time format in Excel

Though Microsoft Excel provides a number of predefined time formats, you may want to create your own one that fits best for a particular sheet. This can also be done using the Format Cells dialog box:

  1. Select the target cells.
  2. Press Ctrl + 1 to open the Format Cells dialog.
  3. Under Category, select Custom and type the desired format code in the Type box.
  4. Review the Sample value to check if it's formatted as expected.
  5. Click OK to save the changes.

For example, to format a date time value like 1-Jun-2025 9:30 AM, utilize this code: d-mmm-yyyy h:mm AM/PM. Create a custom time format in Excel.

The custom time format you've created will be in the Type list the next time you need it.

Tip. The easiest way to make a custom time format is to use one of the existing formats as a starting point. For this, click Time in the Category list, and select one of the predefined formats under Type. After that switch to Custom and make the changes to the format displayed in the Type box.

Excel time formatting codes

When creating a custom time format in your worksheets, 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

12 hour time format in Excel

To set the 12 hour format for times in Excel, include AM/PM in the format code that you enter in the Format Cells dialog.

Format Displays as
h:mm:ss AM/PM 1:30:00 PM
h:mm AM/PM 1:30 PM

To change time to 12 hour format, you can also use the TEXT function with one of the codes listed above.

Assuming the original time value is in A3, the formula takes this form:

=TEXT(A3,"hh:mm:ss AM/PM") Change time to 12 hour format.

Note. The TIME function converts a time value into a text string. If you intend to calculate times at a later point, then set a custom 12-hour format using the Format Cells dialog.

24 hour time format in Excel

To apply the 24 hour time format, use any format code without AM/PM.

Format Displays as
h:mm:ss 13:30:00
h:mm 13:30

Once you've decided on the format code, apply a corresponding custom format to the original cell or supply the format code to the TEXT function to return a formatted time in another cell. Remember that in the latter case, the output will be a text string.

With the source time in A3, the formula goes as follows:

=TEXT(A3,"hh:mm:ss") Change time to 24 hour format.

Excel time format over 24 hours

When adding up times, the total may exceed 24 hours. To format times over 24 hours correctly, enclose the hour code in square brackets like [h].

Here are some examples of time formats over 24 hours:

Format Displays as Explanation
[h]:mm 41:30 41 hours and 30 minutes
[h]:mm:ss 41:30:10 41 hours, 30 minutes and 10 seconds
[h] "hours", mm "minutes", ss "seconds" 40 hours, 30 minutes, 10 seconds
d h:mm:ss 1 17:30:10 1 day, 17 hours, 30 minutes and 10 seconds
d "day" h:mm:ss 1 day 17:30:10
d "day," h "hours," m "minutes and" s "seconds" 1 day, 17 hours, 30 minutes and 10 seconds

For more information, please see how to show, add, subtract over 24 hours, 60 minutes, 60 seconds.

Excel date time format

To create custom formatting for date and time, use various combinations of time and date format codes.

The following table provides some examples of how your Excel date time formats may look like:

Format Displays as
d-mmm-yy h:mm:ss AM/PM 13-Jan-25 1:30:00 PM
mmmm dd, hh:mm AM/PM January 13, 01:30 PM
dddd, m/d/yy h:mm:ss Monday, 1/13/25 13:30:00
ddd, mmmm dd, yyyy hh:mm Mon, January 13, 2025 13:30

Excel time format without date

To format a date time value so that only time is visible in a cell, use only the time codes without the date codes. At that, you can use the international standard notation such as hh:mm:ss or your custom notation. Here are a few examples:

Format Displays as
h:mm:ss AM/PM 1:30:00 PM
hh:mm:ss AM/PM 01:30:00 PM
hh:mm:ss 13:30:00
hh-mm-ss 13-30-00
hh.mm.ss 13.30.00

How to format negative time values

The custom time formats discussed above work for positive values only. If the result of your calculations is a negative number formatted as time (e.g. when you subtract a bigger time from a smaller one), the result will be displayed as #####. If you want to format negative time values differently, the following options are available to you:

  • Display an empty cell for negative times. Type a semicolon at the end of the time format, for example [h]:mm;
  • Display an error message. Type a semicolon at the end of the time format, and then type a message in quotation marks, e.g. [h]:mm;"Negative time"

Generally speaking, a semicolon acts as a delimiter to separate positive values' format from negative values' formatting. For full details, please see Custom Excel number format.

If you want to display negative times as negative values, e.g. -10:30, the easiest way is to switch to Excel's 1904 date system. For this, click File > Options > Advanced, scroll down to When calculating this workbook section and check the Use 1904 date system box.

For more information, please see How to calculate and display negative times in Excel.

Excel default time format

When setting up a time format in the Format Cells dialog, you may have noticed that one of the formats begins with an asterisk (*). This is the default time format in your Excel. The default time format in Excel

To quickly apply the default Excel time format to the selected cell or a range of cells, go to the Home tab > Number group, and choose Time from the Number Format drop-down list. Apply the default time format in Excel

How to change the default time format

To change the default time format in Excel, this is what you need to do:

  1. Open the Control Panel and click Region. If your Control panel opens in Category view, then click Clock and Region > Change the date, time, or number format.
  2. In the Region dialog box, set the Short time and Long time formats you want. Change the default time format in Excel.

Now that you've got the hang of time formatting in Excel, it will be much easier for you to manipulate date and time values in your worksheets. I thank you for reading and hope to see you on our blog next week!

Practice workbook for download

Excel time formatting - examples (.xlsx file)

269 comments

  1. Hi, i would like to calculate the 'Total Hours' from the 'Start Time" and 'End Time" and afterwards i would want to find out the man-hours from the 'No. of Workers' but in Hours format (2.5h and etc)
    Please help me with the format. Thanks!

    Example:

    No. of Workers Start Time End Time Task Duration Hours
    2 09:00 11:00 02:00 4

  2. I WANT THAT EMPLOYEE WILL ENTER VALUE IN CELL B2 THEN IN C2 THEN IN D2 THEN IN E2 CELL.
    THEN EMPLOEE WILL SAVE ENTRY. DATE AND TIME SHOULD AUTOMATICALLY APPEAR IN CELL A2.
    HOW CAN I DO IT?

  3. I want to calculate the duration over multiple days without having a date in the formula.

    for example

    C1/ D1/ E1
    Start time / End Time / Duration (what i want to work)

    22:00 / 02:30 / 04:30 (calculated total)

    I have also applied the 0/:00 Formula to the whole sheet and I tend to get totals of 0:00 now.

  4. I want to calculate the duration over multiple days without having a date in the formula.

    for example

    C1 D1 E1
    Start time End Time Duration

    22:00

    • Hi,
      Your task is not completely clear to me. For me to be able to help you better, please describe your task in more detail. It’ll help me understand it better and find a solution for you.

  5. Hello,

    I need a formula that counts any time from a previous or current day as a full day.

    Ex.

    1/2/21 13:30 1/3/21 0700 2 full days
    1/2/21 13:30 1/2/21 1400 1 full day

    This is what I get:
    1/2/21 13:30 1/3/21 0700 0
    1/2/21 13:30 1/2/21 1400 0

    • Hello!
      If I got you right, the formula below will help you with your task:

      =ROUNDUP(B1,0) - ROUNDDOWN(A1,0)

      I hope my advice will help you solve your task.

  6. how to record share price change per minute in Live trade market

  7. I was using a spread sheet that required a time on every line. it was programmed to use ` in place of :

    for instance, I could type 7`32 and the time 7:32 AM would appear.

    How do i recreate this?

    • Helllo!
      You may have used Auto Correct Options (Excel options - Proofing). You can set up automatic replacement for ` to :
      I hope this will help.

  8. Hi

    Hoping someone can help.

    I have a time of day for example 09:00 but want it to be displayed as the hour it’s in I.e 09:00-10:00 is there some way to do this quickly please?

    • Hello!
      Here is the formula that should work perfectly for you:

      =TEXT(A1,"hh:mm")&" - "&TEXT((A1+TIME(1,0,0)),"hh:mm")

      I hope it’ll be helpful.

  9. क्रमांक दिनांक नाम
    12755414 12/02/2020 8:37 सुशिल कुमार
    12993741 01/01/2021 17:36 मुन्नु लाल
    13010945 01/04/2021 10:04 बाला
    13081668 1/13/2021 12:39:49 PM मनोहर
    13082304 1/13/2021 1:40:49 PM नितीश
    13103407 1/16/2021 11:27:15 AM जितेश
    13108341 1/16/2021 7:52:29 PM अनिल
    13109480 1/17/2021 8:20:01 AM दीपक

    How to distinct date and time in excel from formula

    • Hi!
      For me to be able to help you better, please describe your task in more detail. Please specify what you were trying to find. Give an example of the expected result.
      It’ll help me understand it better and find a solution for you.

    • Use function "Text to Column" to separate these values in different columns

  10. how to record share price rate change per minute in Live trade market

  11. hello

    in excel i am using Now function to enter the current date and time.
    But i want to fix it.

    How i will do that?

    please help me.

  12. Please help

    two different date and time need difference of both date
    for eg

    12/12/2020 12:00 PM - 12/15/2020 17:00 PM = Difference time () in text format

  13. Hello,

    I'm running into a problem where using the Format properties to change a time value from 24hr to 12 hr is not working. I have to dbl-click in the cell and hit enter for the format change to occur.

    This is an example of the value in the cell: 17:00:00. It will not change to 5:00 pm unless I edit the cell and hit Enter.

    I've tried to use the Calculate Now, Calculate Sheet operations under the Formulas menu but nothing changes the time values.

    Help me, able-won-kenobi!

    Thank you!

    • Hello!
      Unfortunately, I was unable to reproduce your problem on my own. When you change the format, the appearance of the cell changes immediately. How do you change the format? Could you please describe it in more detail? It’ll help me understand it better and find a solution for you.

      • That's the problem, the appearance of the cell DOES NOT change immediately.

        The only way it changes is if I edit the cell and hit Enter. Then it changes to the desired format.

        I changed the format by highlighting the two columns of Time data, right click, select Format Cells ... and change to the desired format Time "1:30 PM".

        That's it. Very annoying.

        • Hello!
          There is probably an error with the data formats in your file. Perhaps this method will help. Copy the date column to Notepad. Then copy the data from the Notepad and paste it in its original place. Apply the format you want.

    • just go in data tab and refresh

  14. 2020-08-18T9:00:00+07:00
    How to create custom formula for this in excel?

  15. total duty Time - total Work Time
    216:00:00 212:16:00 -3:44 this answer ok
    but
    i use same formula
    216:00:00 182:19:00 -9:41 this answer wrong
    why
    this answer -33:41

  16. 216:00:00 212:16:00 -3:44 ok
    but
    same formula
    216:00:00 182:19:00 -9:41 wrong -33:41
    =IF(H7-G7>0, H7-G7, TEXT(ABS(H7-G7),"-h:mm"))

  17. Hello i wanna do a time format that counts down days till expiration and the way its set up is there is the date format in each row is it possible to make 1 date show and each column follow that date with multiple items and different expiration dates?

  18. Hello - Is there a source that shows how to create a formula that calculates the "duration" it takes someone to do something?
    Ex. All I have are "start time" in one column, and in the next "end time".
    Example, one column says the time that Jeff texted me = 07/10/2020 at 12:00 p.m.
    In the other column, it shows my response time to Jeff being the next day on 07/11/2020 at 06:00 p.m.
    How can I create a formula that would automatically give me "30 hours" - since the response time took thirty hours?

    • Hello Isabella!
       Subtract the start time from the end time. Then apply a custom time format. To be able to show more than 24 hours in a cell, please use this time format: "37:30:55". You can find it in the list of Excel time formats.

  19. How can I do 23:50 - 00:00? For example if its 23:50 on a tuesday then 00:00 on a wednesday?

    • Hello Rebecca!
      If I understand your task correctly, if the time difference is negative, add 1 day (24 hours)

      =IF(B3>B1,B1-B3+1,B1-B3)

      To the start time you need to add 1 day.
      I hope it’ll be helpful.

  20. I am entering 10.40 and the cell is changing it to 9.36 am automatically, please share why?

    • Hello!
      Date is stored in Excel as a number. 10.40 is 1/10/1900 09:36:00. To get the time, you need to enter it correctly. Use a colon. (9:36:00).

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