I'm trying to show UTC and local time in a 12 and 24 hour format. Im using the following code:
Private Sub Timer1_Timer()
GetSystemTime zt
txt12.Text = Right(DateAdd("h", -5, Format(zt.wHour, "00") & ":" & Format(zt.wMinute, "00") & ":" & Format(zt.wSecond, "00")), 11)
txt24.Text = Right(DateAdd("h", -5, Format(zt.wHour, "00") & ":" & Format(zt.wMinute, "00") & ":" & Format(zt.wSecond, "00")), 11)
txtZT.Text = Format(zt.wHour, "00") & ":" & Format(zt.wMinute, "00") & ":" & Format(zt.wSecond, "00")
End Sub
txt12 is my 12 hour format local time an txtZT is my UTC. They both work fine. I can't figure out how to format to make it local time in the 24 hour format. I've played around with a couple of different things but the best I can get is the local time in 24 hour as a time stamp. Any thoughts would be appreciated. The above code is just where I left it to put it in this thread.
Thanks,
Tony
Private Sub Timer1_Timer()
GetSystemTime zt
txt12.Text = Right(DateAdd("h", -5, Format(zt.wHour, "00") & ":" & Format(zt.wMinute, "00") & ":" & Format(zt.wSecond, "00")), 11)
txt24.Text = Right(DateAdd("h", -5, Format(zt.wHour, "00") & ":" & Format(zt.wMinute, "00") & ":" & Format(zt.wSecond, "00")), 11)
txtZT.Text = Format(zt.wHour, "00") & ":" & Format(zt.wMinute, "00") & ":" & Format(zt.wSecond, "00")
End Sub
txt12 is my 12 hour format local time an txtZT is my UTC. They both work fine. I can't figure out how to format to make it local time in the 24 hour format. I've played around with a couple of different things but the best I can get is the local time in 24 hour as a time stamp. Any thoughts would be appreciated. The above code is just where I left it to put it in this thread.
Thanks,
Tony