Convert time to military

datadummy

Active Member
Joined
Mar 16, 2017
Messages
312
Office Version
  1. 365
Platform
  1. Windows
I am trying to convert time to military but can't seem to get it to work. I have gone into format and changed the cell(s) to h:mm or h:mm AM/PM or even the various options within the time format "13:30", "13:30:55". Regardless of what format I choose the cell always turns to 0:00 and then in the formula bar it always shows the data as "2/23/1904 12:00:00 AM". Any thoughts on how to alleviate this and have it show as military time?
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
I am trying to convert time to military but can't seem to get it to work. I have gone into format and changed the cell(s) to h:mm or h:mm AM/PM or even the various options within the time format "13:30", "13:30:55". Regardless of what format I choose the cell always turns to 0:00 and then in the formula bar it always shows the data as "2/23/1904 12:00:00 AM". Any thoughts on how to alleviate this and have it show as military time?
Use a Custom Format using this type pattern... hhmm
 
Upvote 0
I gave that a shot and it left the times as "0000".
That is what you would get if your cell does not contain a time value in it. Are you sure you applied the Custom Format to a cell or cells having real dates and times and/or just real times in it?
 
Upvote 0
That is what you would get if your cell does not contain a time value in it. Are you sure you applied the Custom Format to a cell or cells having real dates and times and/or just real times in it?

So far I have tried entering just times for example 1130 and it changes the time to 00:00.
 
Upvote 0
Are you converting via a formula or with the cell formatting?

Can you give an example?

So far just with the formatting, so as of now I have numbers in "0000" form i.e. 1130,0457,1840. I tried a macro and it seemed to be working and then stopped for some reason.
 
Upvote 0
So far just with the formatting, so as of now I have numbers in "0000" form i.e. 1130,0457,1840. I tried a macro and it seemed to be working and then stopped for some reason.

As Rick mentioned, 1130 is not a true time value. You can either Custom Format the cell that houses 1130 as "00\:00" or you can convert 1130 in another cell with

=TEXT(A1,"00\:00")+0

If you Custom Format the cell, you'll need to convert that cell using the TEXT formula if you wish to do calculations.
 
Upvote 0
As Rick mentioned, 1130 is not a true time value. You can either Custom Format the cell that houses 1130 as "00\:00" or you can convert 1130 in another cell with

=TEXT(A1,"00\:00")+0

If you Custom Format the cell, you'll need to convert that cell using the TEXT formula if you wish to do calculations.

I used the custom format "00\:00" and that did the trick. Thanks for the help!
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top