date conversion from julian to sqlserver datetime datatype

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Apotluri
Premium Member
Premium Member
Posts: 25
Joined: Sun Dec 25, 2005 10:38 pm

date conversion from julian to sqlserver datetime datatype

Post by Apotluri »

I am trying to convert julian date format to a target field which is in datetime datatype in sqlserver.
I tried by using DateGenericGetDate function, but in transformer help it was given that the output will be in string format.But, I am looking to get the output as datetime data type.

Thanks in advance
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Clarify something. You've posted in the Server forum but marked the job type as Parallel. Plus you've referenced a function that sounds an awful lot like the sdk transforms that come with the Server product. Just want to make sure which job type this is in reference to.

Also, it would probably be prudent to clarify what you mean by 'Julian' date. Is it a real Julian date, which is the number of days from a certain base date? Or is it really an Ordinal date which is the year combined with the day number of the current date within that year?

Examples are always good. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Apotluri
Premium Member
Premium Member
Posts: 25
Joined: Sun Dec 25, 2005 10:38 pm

Post by Apotluri »

Thanks for your reply

I guess the date is Ordinal date. example:2005191
Even though the job is developed in Parallel, I used Basic Transformer to use these DateGenericGetYear,DateGenericGetMonth and DateGenericGetDay functions.

I am getting this ordinal date with datatype as decimal(7).I want to convert this date and send that converted date in to target database SQLSERVER with datatype as datetime.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I'm sure there are parallel functions you can use, others would need to help with that. If you want to pursue a Server / BASIC Transformer solution then I'd suggest you look at the DateGenericToTimestamp sdk routine. It illustrates how to handle those Ordinal dates (what it calls 'Julian Year Days') via Iconv / Oconv.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Given that we're in the server edition forum, I'd say Craig has nailed it. That form of date can be converted with the "J" control in Iconv/Oconv. Here is an example:

Code: Select all

Oconv(Iconv(InLink.TheDate), "DYJ"), "D-YMD[4,2,2]")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply