LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time format with scan from string function

Solved!
Go to solution

Hi all, I have next code:

 

EDGAR_PLATRONICS_0-1689620256029.png

When I run, I have next output:  4:03:08.000 PM 3/16/2022. Does anyone know why I have a "4" at the beginning of the output? How can I fix it? 

Thanks for any help

0 Kudos
Message 1 of 7
(704 Views)

What time are you expecting?

Are you using UTC time or local time?

Are you using daylight saving time?

 

George Zou
0 Kudos
Message 2 of 7
(695 Views)

Hi George,

Thanks for your help

I am using local time and also using  daylight saving.

 

0 Kudos
Message 3 of 7
(678 Views)
Solution
Accepted by topic author EDGAR_PLATRONICS

Your format string should be:

%<%m/%d/%Y %I:%M:%S %p>T

Message 4 of 7
(676 Views)

I'm not sure why it causes 4 PM but I think "%h" is wrong. Lower case h isn't listed in the format codes so it's hard to know what it's doing. Since you have 12 hour time you probably want "%<%m/%d/%Y %I:%M:%S %p>T" as your format string. %I is 12 hour time, %p grabs the AM/PM.

0 Kudos
Message 5 of 7
(667 Views)

Thank you George, problem fixed. After reading help, I found %I is for 12-hours format and %p is for AM PM flag. Thank you again.

0 Kudos
Message 6 of 7
(650 Views)

Thank you

0 Kudos
Message 7 of 7
(648 Views)