Tag Archives for " #date "

Nov 30

Use RPG to find the day of the week

I wanted a handy little RPG code snippet to return the day name for a date. My requirement was to  feed in a date like “Nov 30 2017” and it to tell me that its ‘Thursday’. Google to the rescue, I found a nice little article by RAFAEL VICTORIA-PEREIRA (Thankyou Sir!) which has a code sample […]

More Waffle
Jul 11

Add days to 100 Year date from EXCEL using RPG

So, we had a file coming in from an external partner today – containing a date in Julian Format. Or what I initially thought to be Julian format. [quote=Some Website Out There]Many applications (especially mainframe systems) store dates in the Julian format. Julian dates (abbreviated JD) are simply a continuous count of days and fractions […]

More Waffle
Jul 11

Convert RPG Datefield %DATE into a signed numeric

To convert a RPG DATEFIELD to this numeric 8,0 field with no ‘/’ or ‘-‘ do this: D USADate 8s 0 USADate = %dec(%char(DateField:*iso0):8:0); Or another even neater function is this: USADate = %uns(%char(DateField:*USA0)); I prefer this %UNS built in function, since it does not require me to specify length and decimal position parameters. What […]

More Waffle
Mar 12

another as400 jba date conversion routine

jba chertsey as400 system21 erp nick downes nee litten steve stephen rees claire mckeown brian stagg jodie stagg spoonface paul crtis toby schofield

Here’s the other date conversion – It’s a JBA date (7,0 numeric) to 8 character alpha in JIS format (YYYYMMDD) with no separators. If you want separators in your result then simply expand the result field by 2 characters (to 10) and replace the “0” in the “*jis0” with what ever separator you prefer. Eval […]

More Waffle
Oct 14

How to change MMDDYY to CYYMMDD in one line of RPGLE

Heres one to change a 6,0 numeric date in MMDDYY form to 7,0 numeric date in CYYMMDD form. Eval INTERNAL_DATE = %dec(%char(%date(EXTERNAL_DATE:*mdy) :*cymd0):7:0) INTERAL_DATE is the 7,0 CYYMMDD date. EXTERNAL_DATE is the 6,0 MMDDYY date. Convert RPG Datefield %DATE into a signed numericTo convert a RPG DATEFIELD to this numeric 8,0 field with no ‘/’ […]

More Waffle