Page 1 of 1

date conversion from julian to sqlserver datetime datatype

Posted: Fri Nov 17, 2006 11:37 pm
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

Posted: Sat Nov 18, 2006 9:02 am
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:

Posted: Sat Nov 18, 2006 8:16 pm
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.

Posted: Sat Nov 18, 2006 9:48 pm
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.

Posted: Sun Nov 19, 2006 9:41 am
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]")