How to Convert Military Time to Standard Time in Google Sheets

Published on

When recording time, you may often use the military time format, which is a 24-hour format without AM/PM. In Google Sheets, you can use formulas or the formatting menu to convert military time to standard time (a 12-hour format with AM/PM).

In a 24-hour clock, time is written as HH:MM or HH:MM:SS. For example, 23:15 is equal to 11:15 PM in a 12-hour format. Sometimes, military time might also be entered as 231500, which corresponds to 23:15:00.

Let me show you how to convert military time to standard time in Google Sheets using both formulas and custom time formatting.

Convert Military Time to Standard Time Using Custom Time Formatting

To convert military time to standard time directly within a cell or cell range, you can apply custom formatting without using a formula. Follow these steps:

  1. Select the cell or range that contains the time.
  2. Click Format > Number > Custom Date and Time.
  3. Choose a format, such as 1:25 PM or 1:25:59 PM.
  4. Click Apply.

There is another option using custom number formatting:

Converting 24-hour time format to 12-hour format in Google Sheets
  1. Click Format > Number > Custom Number Format.
  2. Enter one of the following time formats in the provided field: hh:mm AM/PM or hh:mm:ss AM/PM.
  3. Click Apply.

Convert Military Time to Standard Time Using Formulas

When using a formula to convert military time to standard time, remember that the result will be in text format, which means it won’t be usable in calculations.

Assume the time in cell A1 is 23:22:12. The following formula in cell B1 will convert it to 11:22:12 pm:

=TEXT(A1,"HH:MM:SS AM/PM")

If you have military time entered as 232212 (without the standard colon delimiter separating hours, minutes, and seconds) in column A, you can convert it to standard time in a 12-hour format using the following formula:

Enter this formula in cell B1 and drag it down as needed:

=TEXT(TIMEVALUE(LEFT(A1, 2)&":"&MID(A1, 3, 2)&":"&RIGHT(A1, 2)),"HH:MM:SS AM/PM")

Explanation:

  • The LEFT, MID, and RIGHT functions extract two digits from the left, middle, and right of the string, respectively.
  • The extracted parts are combined using the ampersand (&), with “:” as the delimiter.
  • TIMEVALUE converts the resulting text into an actual time value, and TEXT formats it into a 12-hour time format.

Alternatively, you can use the following REGEXREPLACE formula to convert military time (entered without colons) to standard 12-hour time format:

=TEXT(TIMEVALUE(REGEXREPLACE(REGEXREPLACE(A1&"", "(\d{2})", "$1:"), ":$", "")),"HH:MM:SS AM/PM")

This formula uses REGEXREPLACE to insert colons after every two digits, except for the last pair and then converts it to standard time.

Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

How to Create a Searchable Table in Excel Using the FILTER Function

Finding specific records, or rows containing the required information, is straightforward in Excel using...

Time Sequences in Excel by Minute, Hour, or Second Increments

Creating time sequences, whether by hour, minute, or second increments in Excel, can be...

Finding Most Frequent Text in Excel with Dynamic Array Formulas

Looking to identify the most frequently occurring text in Excel? You can do this...

Hierarchical Numbering Sequences in Excel

Creating hierarchical numbering sequences in an Excel spreadsheet can significantly improve the way you...

More like this

XMATCH Row by Row: Finding Values Across a Range in Google Sheets

Using the BYROW function with XMATCH in Google Sheets allows us to match values...

Limit Formula Expansion to a Specific Row in Google Sheets

In this tutorial, I’ll explain how to limit the expansion of an array formula...

3-D Referencing Structured Data Tables in Google Sheets

When you have several tables within a single sheet—not across multiple sheets in a...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.