Is there a date format code for am/pm

Previous topic - Next topic

LWagner

My users want to see a full posting date timestamp from reports.

Is there a code for the am/pm literal that appears after date and time, such as "m".

Justin Derrick

Excellent question -- there doesn't appear to be a 'format parameter' for AM/PM in the CMOD 8.5 online help.

The conventions in the online documentation are extremely similar to UNIX date formatting, so you may be able to use them.

https://en.wikipedia.org/wiki/Date_%28Unix%29

Specifically:

%l (Percent-Lowercase-L) for 12-hour clock hour field.
%I (Percent-Captial-I) for a 12-hour clock with a leading zero.

%p (Percent-Lowercase-P) for uppercase AM/PM
%P (Percent-Capital-P) for lowercase am/pm. 
(These two seem backwards, no?)

On my system, %p gives 'pm', and %P gives 'P' -- which could either be single-character PM, or maybe it doesn't recognize that code and simply prints the letter P.

Give it a try and let us know how it turns out.

-JD.
Call:  +1-866-533-7742  or  eMail:  jd@justinderrick.com
IBM CMOD Wiki:  https://CMOD.wiki/
FREE IBM CMOD Webinars:  https://CMOD.Training/
IBM CMOD Professional Services: https://CMOD.cloud

Interests: #AIX #Linux #Multiplatforms #DB2 #TSM #SP #Performance #Security #Audits #Customizing #Availability #HA #DR

LWagner

I have new reports with date time stamp having 12 hour hh:mm:ss  plus am/pm format, and they want the accurate date. so accepting am/pm is required.

I can break into a date piece and a time piece, time as text with the am/pm.

good enough.