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,909 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,887 Views)

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

 

Ben64

Message 3 of 7
(7,886 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,884 Views)

Thanks alot!

0 Kudos
Message 5 of 7
(7,878 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,874 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,843 Views)