1959047
1963112
1951356
1967027
1958213
this is the value of the date, i think the first 4 digit is the year ? and the remaining 3 is day of the year ? If so , how should i make it into yyyy-mm-dd format?
is there any ways to do it ?
thanks.
Mainframe Date Convert
Moderators: chulett, rschirm, roy
I presume it is defined as a string in the source?
So, split the string 'YYYYint' into YYYY (where you change it to a date YYYY-01-01) and the int value
Convert the date into a julian date
Add the two int values together (I think you need to subtract 1)
Convert the new julian date to the date format of your desire.
So, split the string 'YYYYint' into YYYY (where you change it to a date YYYY-01-01) and the int value
Convert the date into a julian date
Add the two int values together (I think you need to subtract 1)
Convert the new julian date to the date format of your desire.
_________________
- Susanne
- Susanne
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Premium Member
- Posts: 43
- Joined: Wed Feb 27, 2008 1:08 am
Re: Mainframe Date Convert
select to_char(CAST(TO_DATE (yourdate, 'yyyyddd') as timestamp),'yyyy-mm-dd') from yourtable;
RAJ
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Re: Mainframe Date Convert
Why do you think the source is a database (and what kind of database do you believe it to be)? Source data are coming from a mainframe, and its structure is defined in a COBOL file definition.rajadommeti wrote:select to_char(CAST(TO_DATE (yourdate, 'yyyyddd') as timestamp),'yyyy-mm-dd') from yourtable;
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.