LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

GetDate/ format date time string

Solved!
Go to solution
Highlighted

Hello everyone,

I needed some help figuring why i can't use %p to denote A.M and P.M on my outut screen. When i run the application i get the time but not the denote am/pm.

I've attached both the image and the VI.

Download All
0 Kudos
Message 1 of 7
(2,286 Views)
Highlighted
Solution
Accepted by JÞB

The 12 hour clock used %I for the hour.

 

The correct format string is %I:%M:%S %p

Message 2 of 7
(2,264 Views)
Highlighted

Use % I instead of %H, %H is for 24h clock.

 

Ben64

--------------------------------------------------
The best way to say thanks is to give kudos!
Message 3 of 7
(2,263 Views)
Highlighted

Refer to this forum post for the answer:

 

http://forums.ni.com/t5/LabVIEW/Using-Format-Date-Time-String-Function-Vi/td-p/1581082

 

 

In short, replace the %H with %I to go from 24 hour format to 12-hour format.

0 Kudos
Message 4 of 7
(2,261 Views)
Highlighted

Thanks alot!

0 Kudos
Message 5 of 7
(2,255 Views)
Highlighted

Thanks alot!

Since i was testing in the morning i never saw anything passed 12 P.M

0 Kudos
Message 6 of 7
(2,251 Views)
Highlighted

Have one on me Bill!

Capture.PNG

Bad format strings can be a pain.  You simply cannot use "H" and expect a "%p" to make any difference!  "%H" denotes a 24hour clock where AM and PM are meaningless  and capitolization is important to format strings. 

"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 7
(2,220 Views)