Military time to regular time in different timezone

Mux99

Board Regular
Joined
Apr 15, 2019
Messages
57
Hi All

I would like to convert a list of military time in Column C to regular time in a different time zone (+3hr) and also deduct 45 minutes off the new calculated time.

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Scedule[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Title[/TD]
[TD]Description[/TD]
[TD]Time[/TD]
[/TR]
[TR]
[TD]Test1[/TD]
[TD]Apple[/TD]
[TD]620[/TD]
[/TR]
[TR]
[TD]Test2[/TD]
[TD]Banana[/TD]
[TD]1050[/TD]
[/TR]
[TR]
[TD]Test3[/TD]
[TD]Orange[/TD]
[TD]2015[/TD]
[/TR]
</tbody>[/TABLE]


After running the macro it should look like the below. Column D = +2 hours 15 minutes. Column E = +3 hours.

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Schedule[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Title[/TD]
[TD]Description[/TD]
[TD]Time[/TD]
[TD]From[/TD]
[TD]To[/TD]
[/TR]
[TR]
[TD]Test1[/TD]
[TD]Apple[/TD]
[TD]620[/TD]
[TD]08:35[/TD]
[TD]09:20[/TD]
[/TR]
[TR]
[TD]Test2[/TD]
[TD]Banana[/TD]
[TD]1050[/TD]
[TD]13:05[/TD]
[TD]13:50[/TD]
[/TR]
[TR]
[TD]Test3[/TD]
[TD]Orange[/TD]
[TD]2015[/TD]
[TD]22:30[/TD]
[TD]23:15[/TD]
[/TR]
</tbody>[/TABLE]

Thanks in advance
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hi. Try.
Code:
Sub MilitaryTimeToRegularTime()
 Dim mh As Range
  For Each mh In Range("C3:C" & Cells(Rows.Count, 3).End(3).Row)
   mh.Offset(, 1).Value = TimeValue(Format(mh.Value, "0\:00")) + TimeValue("02:15")
   mh.Offset(, 2).Value = TimeValue(Format(mh.Value, "0\:00")) + TimeValue("03:00")
  Next mh
End Sub
And format D:E as desired.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,213
Members
452,618
Latest member
Tam84

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