Just use the SQL Function Julian_Day.
Values(Hex(Date('11/20/2014')); --> Result = 00257D96
Values(Julian_Day(Date('11/20/2014'))); --> Result = 2456982
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im Auftrag von Brian
Gesendet: Monday, 24.11 2014 17:24
An: rpg400-l@xxxxxxxxxxxx
Betreff: Convert Julian Hex Date to Another Format
Hello List,
I have a complicated date conversion I am trying to accomplish. Here is the
situation, with some example data. I've just not been able to figure out
how to handle this so hopefully someone can assist.
I am receiving from an ERP system a hex value for a Julian date. This is a
real Julian date, not a JDE type of date. Ultimately I need to convert this
to YYYYMMDD format.
The hex is just simple text like this: 257D96 This hex should convert to a
decimal value of: 2456982 When putting in this value on a Julian date
conversion page, I get this as the date: 11/20/2014
This all works awesome when I do it by hand using Notepad++ and a web page
:)
Problem is, I can't seem to figure out how to do the same in RPG.
I was able to use 'cvtch' to get my text representation of the hex number
converted in to real hex. But, I've tried the overlay method of getting the
decimal equivalent of the hex number and that has not worked.
To be honest though, I am not sure what the exact best approach here should
be anyway. So, rather than maybe explain how I would try and do this or
think I should, I'll ask the group and see what you all think.
Thanks in advance for any advice. It is appreciated.
Brian
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.