× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Paul Jackson wrote:

I need to convert a 26 character system timestamp (Z type) to a
string that goes something like: "nn:nn AM/PM, Day name, Month
name DD, YYYY".

At first I saw the CEEDATE API and got excited as it seemed to be
able to output that format precisely and then noticed that it
cannot take a time as input, only Lilian days (which makes me
wonder why it allows you to specify the time symbols on the input
picture string).

Anyway it looks like I can use CEEDATE to get the date part
formatted and then manually do the time section.

Just wondering if anyone has a better solution or suggestion,
don't want to reinvent the wheel as I'm sure this has been done
elsewhere.


Not necessarily _better_ than other possible solutions, but the following represents one possible language sensitive solution using the SQL; with day & month names coming from the messages CPX9034 & CPX3BC0 in *LIBL/QCPFMSG, respectively:

<code>

D TS S Z inz(*SYS)
D LD S 56A varying
C/Exec SQL
C+ Set Option Commit=*NONE, DatFmt=*ISO
C/End-Exec

C/Exec SQL
C+ values
C+ /* "nn:nn XM, Day_name_, Month_nam DD,YYYY" */
C+ /* ....+....1....+....2....+....3........ */
C+ /* scale represents maximum US English size */
C+ char( time( :TS ), USA) concat ', ' concat dayname( :TS )
C+ concat ', ' concat monthname( :TS ) concat ' '
C+ concat digits( decimal( day( :TS ), 2, 0 ) ) concat ','
C+ concat digits( decimal( year( :TS ), 4, 0 ) )
C+ into :LD
C/End-Exec
/free
*inlr = *on;
/end-free

</code>

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.