RPG Free Time Stamp Extract (last time, I promise!)

RPG Free Time Stamp Extract (last time, I promise!)

Post by Jonathan B » Thu, 03 Mar 2005 08:19:00


Inspired by the earlier example of using a procedure, I came up with
the following. This would be useful if you had several different
timestamp fields for which you wanted to extract the time portion in
*usa format, or if this extraction requirement were to occur throughout
your application. If you only have the one field, it's probably better
just to do it in two steps as in my original solution. You could save
two whopping lines of code by coding the RETURN statement in the
subprocedure on a fixed-position calculation specification line.

d TheTimeChar s 10

d GetUSATime pr t timfmt(*usa)
d PTimestamp z

/free
TheTimeChar = %char(GetUSATime(TMSTMP));
return;
/end-free

p GetUSATime b
d pi t timfmt(*usa)
d PTimestamp z
/free
return %time(PTimestamp);
/end-free
p e



+
+
 
 
 

RPG Free Time Stamp Extract (last time, I promise!)

Post by Chri » Thu, 03 Mar 2005 20:37:43

Tx. That's cleaner.

Chris

 
 
 

RPG Free Time Stamp Extract (last time, I promise!)

Post by Jonathan B » Thu, 03 Mar 2005 23:57:47


Check out Birgitta's solution; it's cleaner still. I
didn't know about the second formatting parameter for
%CHAR.