LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting time to 24-hr clock

Can anyone help me with converting the standard time/date function outputs to military(24hr)time display? I'm running WinXP, and for my application, I have to use the 24 hour clock system, and not AM/PM.

thanks in advance
0 Kudos
Message 1 of 7
(4,624 Views)
Hello JMorgan,

have you tried "Format Date/Time string"? It's pretty mighty...
You can also change your Windows setting to use a different time format 🙂

Best regards,
GerdW
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(4,618 Views)
Hi

One option is to use the %H specifier as part of the format string for the "Format Date/Time String.vi". See the VIs help for more details.

Regards
Neil
Message 3 of 7
(4,616 Views)
I have a similar problem. I want to read a time from a text file (06:50PM) for example, and convert it to military time (18:50) and save it to a spreadsheet (or text) file. The attached file is an example.  I keep getting the PM part stripped off the file. I'm new to Labview, so I imagine this is an easy thing I'm simply missing.
0 Kudos
Message 4 of 7
(4,437 Views)

What function are you using to read the file and what version of LabVIEW are you using?

If you have LabVIEW 8.2, then you can use Read From Spreadsheet to get strings. Just click on the polymorphic selector below the fucntion or right click on the function and do a Select Type>String. If you are using an earlier version, then Read From Spreadsheet can be modified to read strings instead of SGLs. There are instructions on the block diagram. After modification, save the funciton with a new name and to a new location.

Message 5 of 7
(4,429 Views)
Hi!

I have tried "read from spreadsheet" and "read from text". I have Student Version 7.1. I will try this in the morning.

Thanks!
0 Kudos
Message 6 of 7
(4,424 Views)
That did the trick!

Thanks again!
0 Kudos
Message 7 of 7
(4,408 Views)