I do not know about data types, but for timestamp to date we use:
C &(2:) DIV 1000000000000 &(1:)
with Parm1 being DateISO, and Parm2 being TimeStampISO
We do not appear to have any code for timestamp to time, but we do have the following for hours, minutes, and seconds. It looks like these could be adapted, or you could use Time6 and convert that.
Hours, Parm1 is TimestampISO, Parm 2 is Hours
* Get Time From Timestamp
C* &(2:) DIV 1000000 MYTIME 6 0
* Get Hour From Time
C* MYTIME DIV 10000 &(1:)
C EVAL &(1:) = %subdt(%timestamp(&(2:)):*HOURS)
Minutes: Parm1 is TimestampISO, Parm 2 is minutes
* Get Time From Timestamp
C* &(2:) DIV 1000000 MYTIME 6 0
* Get Minute From Time
C* MYTIME DIV 100 &(1:)
C EVAL &(1:) = %subdt(%timestamp(&(2:)):*MINUTES)
Seconds: Parm1 is TimestampISO, Parm 2 is Seconds
* Get Time From Timestamp
C* &(2:) DIV 1000000 MYTIME 6 0
* Get Second From Time
C* Z-ADD MYTIME &(1:)
C EVAL &(1:) = %subdt(%timestamp(&(2:)):*SECONDS)
Original Message:
Sent: 01-06-2020 06:25 AM
From: Gunnar Gunnarsson
Subject: Ile-Rpg generator. Get Date from Timestamp
I need code to extract Date (and Time) from Timestamp in Server function (ile-rpg). This looks promising:
/FREE
&(2:) = %date(&(1:):*ISO);
&(3:) = %time(&(1:):*ISO);
/END-FREE
Here the parameters are from FIELDS; TimeStampISO, DateISO, TimeISO.
But those fields are generated as Zoned numeric, not as native ile-rpg Datetypes, so %Build in function are not possible.
Any suggestion ?