× 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.



Hi Paul,

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".

You were very close with the CEEDATE thing -- and you're right, CEEDATE only supports dates. However, the very closely related CEEDATM API supports timestamps.

You'll actually need two APIs... CEESECS to convert the RPG timestamp into seconds, and the CEEDATM API to convert the seconds into the fancy formatted date.

Here's a quick example that uses the DSPLY opcode to show a fancy-format of the current date/time.

H DFTACTGRP(*NO)

D CEEDATM PR opdesc
D input_secs 8f const
D picture 100a varying const
D timestamp 100a varying options(*varsize)
D fc 12a options(*omit)

D CEESECS PR opdesc
D input_ts 100a varying const
D picture 100a varying const
D output_secs 8f
D fc 12a options(*omit)

D myTimestamp s Z inz(*sys)
D mySecs s 8f
D myTimeString s 52a varying

/free
CEESECS( %subst(%char(myTimestamp: *iso0):1:17)
: 'YYYYMMDDHHMISS999'
: mySecs
: *omit );

CEEDATM( mySecs
: 'HH:MI AP Wwwwwwwwwz, Mmmmmmmmmz DD, YYYY'
: myTimeString
: *omit );

dsply myTimeString;
*inlr = *on;

/end-free

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.