ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

GetDate/ format date time string

Solved!
Go to solution

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
(7,911 Views)
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
(7,889 Views)

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

 

Ben64

Message 3 of 7
(7,888 Views)

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
(7,886 Views)

Thanks alot!

0 Kudos
Message 5 of 7
(7,880 Views)

Thanks alot!

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

0 Kudos
Message 6 of 7
(7,876 Views)

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
(7,845 Views)