How to Stop Google Sheets from Changing to Military Time
Are you tired of dealing with the frustration of automatic time conversions in Google Sheets? If you’re seeing 12:00 AM and 12:00 PM changing to 0000 and 1200 respectively, you’re in the right place. Stopping Google Sheets from defaulting to military time, also known as 12-hour clock, can seem daunting, but it’s achievable with a few workarounds. In this article, we’ll share some effective methods to curb this annoyance and make your data handling process more convenient.
The Problem: Why Military Time
Before we dive into the solutions, let’s understand why Google Sheets likes to change your time notation to military format. Upon further investigation, it boils down to the way Sheet handles date and time combinations. By default, numbers with two digits are likely to be interpreted as minute and second values, inadvertently forcing the time to flip into military format. see Table 1 Below
Time Format | Corresponding Date and Time Notation |
---|---|
Hr:Min: Sec (12:30 pm) | 12:15 PM (Automatic Conversion due to 2-digit year 12) |
12:30 p m | What it should be What it becomes |
Table 1: How Google Sheets Conflates Date and Time
The Solution 1: Format Cells explicitly
The simplest way to bypass the military time bug is to format your timestamps as desired. Follow these steps:
- Click on the cell containing your date and time.
- Go to the Formatting Tab (Ctrl +1) or Format > Alignment (for Mac).
- Select the "Dates and Times" option at the top.
- Change the "TimeFormat" to "12 HR". Note: ensure it’s set to"HR" (hour mode), not "24"
- Apply the Changes and confirm.
Benefit: This method keeps the formatting in check.
Drawback: Applying individual cell formatting can result in tedious and time-wasting if you have significant amounts of data.
Alternative Method: Use ‘Number Format’ with Code
The Solution 2: Utilize formulas
Google Sheets offers Number Formats with codes to resolve the issue. Here, you’ll learn how:
- Select the Date and Time column.
- Go to the Main Menu and select "View > Formula" or pressing (Ctrl + Shift =). (for Mac & Linux)
- Delete the existing formatting and wrap your cell values in CODE( format_string, precision ):
CODE("short", "hh:mm") |CODE("short_hms", "hh"):|
**Note:
- short displays times as 12H or 24H: depends on the locale configured
- hs and ms display hours down to minutes and seconds using short numbers; examples:
`12:30PM = 12:00 (24-hour format)’
12:54 PM = 12 PM ‘ **
Code in this manner:
(Cell Formula) =COD(("short", "mm:mm"))
Pitfalls:
· Ensure you’ve selected ‘View’ instead of ‘View Only’. Formula formatting is quite restrictive.
· Be cautioned against formatting issues if inconsistent in formatting across cells/data entries.
Solution Extension: ‘Conditional Formatting + Timestamp’ **
One advanced technique is to Create conditional formatting based on this same principle:
1.Set conditions: (1.
= (OR ( TIMESTAMP()
= &{ cell1} )); and 2.
=(( timestamp(1) ).
4.
(1 to choose
|1)
=
code' ) = // //
// ' | ' // &. | // //.
TIMESTAMP()“
To further simplify the formulas by adding timestamp and custom formula
Conclusion And Advanced Features
Google Sheets auto-formatting often presents unwarranted issues, especially on 12-hour clock timelines. In this article we addressed two solutions to hinder such changes: explicit-cell-formatting and code-wrap in the number format string. For a more fine-grained control, I shared a workaround using Custom Functions ( Timestamp ) Additionally,
· Keep in Touch For further tips and Techniques from our Experts
for tips on handling dates; visit the link below, you’ll find various best practices for handling diverse timestamps, time zones handling; as well as many others.
This article not only offers you a viable alternative but also highlights pitfalls for those seeking to stay aware of formatting quirks that might be lurking unseen