conversion of julian date of format 'yyyyjjj' to date
Moderators: chulett, rschirm, roy
conversion of julian date of format 'yyyyjjj' to date
Hi All,
I want to convert the date format of the type 'yyyyjjj' ex:2006346 to date. and i am trying to do it by using the julianday to date function. but it's not working . The format of the output date is 'yyyy/mm/dd'. how to convert this .
Any help is appreciated.
syam.
I want to convert the date format of the type 'yyyyjjj' ex:2006346 to date. and i am trying to do it by using the julianday to date function. but it's not working . The format of the output date is 'yyyy/mm/dd'. how to convert this .
Any help is appreciated.
syam.
SHYAM
-
- Participant
- Posts: 106
- Joined: Thu Jul 27, 2006 10:05 pm
- Location: Mumbai
There's probably some other cool Julian date functions out there, but here's a quick solution:
dj = '2006346'
oconv(iconv(dj[1,4]:'/01/01','d/ymd[4,2,2]') + dj[5,3],'d/ymd[4,2,2]')
This simply adds internal days at 1st January 2006 plus julian days since (346) and outputs in the format d/ymd[4,2,2].
If you need this to run in enterprise edition, you will have to use a string to decimal conversion on the substring dj[5,3], probably best done by way of a stage variable.
dj = '2006346'
oconv(iconv(dj[1,4]:'/01/01','d/ymd[4,2,2]') + dj[5,3],'d/ymd[4,2,2]')
This simply adds internal days at 1st January 2006 plus julian days since (346) and outputs in the format d/ymd[4,2,2].
If you need this to run in enterprise edition, you will have to use a string to decimal conversion on the substring dj[5,3], probably best done by way of a stage variable.
3NF: Every non-key attribute must provide a fact about the key, the whole key, and nothing but the key. So help me Codd.
-
- Participant
- Posts: 34
- Joined: Fri Sep 22, 2006 10:59 pm
- Location: India
Re: conversion of julian date of format 'yyyyjjj' to date
Hi Syam,syam wrote:Hi All,
I want to convert the date format of the type 'yyyyjjj' ex:2006346 to date. and i am trying to do it by using the julianday to date function. but it's not working . The format of the output date is 'yyyy/mm/dd'. how to convert this .
Any help is appreciated.
syam.
Actually, the data you are getting is not Julian date, it is Ordinal date.
If it is a parallel job, use 'basic transformer' and try with
Oconv(Iconv(link.fieldname,"DYJ"), "D-YMD[4,2,2]"):' 00:00:00'
-APotluri
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
In a server job,
In a parallel job you could use this expression in a BASIC Transformer stage, if you didn't mind the performance penalty.
Otherwise you will need to use parallel job functions. Why not start a new thread on the parallel forum?
Code: Select all
Oconv(Iconv(InLink.TheDate, "DYJ"), "D/YMD[4,2,2]")
Otherwise you will need to use parallel job functions. Why not start a new thread on the parallel forum?
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.