Excel Date and Time Formatting

Mynda Treacy

October 20, 2017

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

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

Excel Date and Time Formatting built in

Custom Excel Date and Time Formatting

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

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

Excel Date and Time Format cells

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

Excel Date and Time custom Format cells

Custom Date Formatting Characters

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

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

Custom Date Formatting Examples

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

Excel Date Formatting example

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

Custom Time Formatting Characters

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

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

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

Custom Time Formatting Examples

Excel Time Formatting example

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

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

More Excel Formatting

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

Free eBook - Working with Date & Time in Excel

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

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

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

28 thoughts on “Excel Date and Time Formatting”

  1. Below is my current battle…

    Sample cell – 11/26/2021 1:24pm
    Custom format – m/d/yyyy h:mm am/pm

    After entering the custom format for the column, I click sort and I am still getting AM times mixed into my PM times…
    11/26/2021 1:55pm
    11/26/2021 1:57pm
    11/26/2021 10:14am
    11/26/2021 10:18pm
    11/26/2021 10:26am
    11/26/2021 10:32am
    11/26/2021 10:33pm
    11/26/2021 10:36pm
    11/26/2021 10:38am

    What am I missing here?!

    Reply
      • Thanks, Mynda, I appreciate you taking the time to answer, but I have no idea how to translate what you’ve told me into a formula in my spreadsheet. If you could speak slowly (all I know about Excel I’ve picked up on my own; I’m absolutely just winging it) or provide a link to an example?

        Reply
        • In this tutorial under the heading Custom Excel Date and Time Formatting I cover the steps for putting that format in your worksheet. If you’re still stuck, please post your question and Excel file on our forum where we can help you further.

          Reply
  2. I’ve downloaded a csv file that has a time on it but when its imported just looks like a number ie 10:46 ,if I open the CSV in Excel and use a formula on it it shows as the decimal equivalent of the number is no longer the same time but rather a decimal representation of it and doesn’t hold the 10:46 i require ,this isn’t then comparable with other sheets that have the correct time format from elsewhere

    I cannot get to change to a time format that equals the original downloaded number/time
    Thank you

    Reply
  3. I can’t find any way to put a date and time with am, pm into one cell, without it being a timestamp.
    I am creating a spreadsheet for keeping track of medicines I take. (I have a crazy dr that makes me bring all my meds in every appointment and have them counted.) So take some meds at wake-up, lunch and bedtime. I currently have a cell for the date of the last appointment and the date of the next appointment with another cell calculating the number of days between the two. I was wondering if there is a way I could put the time and date of each appointment in the cells and somehow create a formula that would count how many pills I took and had left according not just the days between appointments but somehow configuring the time of the appointments. I hope I am describing this correctly. Thanks!!!

    Reply
  4. Please i am looking how to extract the number day of any date ( year days 365)

    for example ( today is 20/11/2019 ) = (number day is (323) from 365 day)

    thanks

    Reply
  5. i am looking for the elegant way to calculate night and day power consumption. the problem is that night tariff is calculated from 23:00 to 7:00, and counter indications are not taken daily.
    e.g.
    26 October, 13:06
    28 October, 11:26
    4 November, 17:46
    how to calculate the time (hours and minutes) that can be attributed to the night/day time?

    Reply
    • Is it enough if you multiply the number of days by 8?
      =CEILING(a2-a1,1)*8
      I assume you have dates in a1 and A2, not text (26 October, 13:06 is missing the year).

      Reply
  6. when downloading information to upload into my accounting software the date is displayed as 01/15/2019 Wed. How can i get rid of the text without doing it individually? I’ve tried to play with the date formatting but haven’t been successful.

    Reply
  7. What if you don’t want your output in military (24-hour time)? I’m doing a value of how many times something is mentioned and converting that value into 15 minute increments. So for example, if something was mentioned twice, that would convert to a half an hour aka 30 minutes.

    I want the display to just display 0:30 to reflect 30 minutes. Or if something is mentioned 4 times, the output should be 1:00 or one hour.

    I don’t need an actual time of day, just a time value to represent the sum of time. Any help here is appreciated.

    Reply
  8. I have a doubt related to how time format and the data input formatting can be locked in excel.
    An excel time schedule need to be filled by a team in a certain cells i.e. Start and End columns and the time by lines [12:00] [13:00].
    Although, the cells are formatting [hh:mm] the team not comply with this format and it is usual to have data inputted as 12h30m, 12.30, 12,30 which retrieves a lot of errors in the linked tables.
    How can I avoid the wrong format data input by the team in the time schedule sheet, can I lock the format in that cells in the way to retrieve an error or not allows to input data unless it is with the right format, something like a drop box in data validation excel feature?
    Many thanks.

    Reply
  9. so many thanks for this effort.
    You are so amazing.
    I noticed that in the Date & Time 101 work sheet, there is a typing mistake.
    You wrote: (24 hours or half of a day, and 1 hour is 0.41666′ because it’s 1/24 of a day.)
    It is 0.041666 not 0.41666
    Kindly correct this also in the PDF.

    Regards.

    Reply

Leave a Comment

Current ye@r *