Author Topic: Is there a date format code for am/pm  (Read 2655 times)

LWagner

  • Guest
Is there a date format code for am/pm
« on: July 29, 2013, 10:36:42 AM »
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

  • IBM Content Manager OnDemand Consultant
  • Administrator
  • Hero Member
  • *****
  • Posts: 2231
  • CMOD Guru for hire...
    • View Profile
    • Tenacious Consulting
Re: Is there a date format code for am/pm
« Reply #1 on: July 30, 2013, 09:25:40 AM »
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.
IBM CMOD Professional Services: http://TenaciousConsulting.com
Call:  +1-866-533-7742  or  eMail:  jd@justinderrick.com
IBM CMOD Wiki:  https://CMOD.wiki/
FREE IBM CMOD Education & Webinars:  https://CMOD.Training/

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

LWagner

  • Guest
Re: Is there a date format code for am/pm
« Reply #2 on: July 30, 2013, 10:35:50 AM »
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.