julian day conversion in SQL

  • quote:


    The values are just the number of the day of an year. I have got year in one column, and just the julian day ( as say, 245) in the next column.

    I did try the code, changing the length of the character to 3, but it might vary too, because the julian day values range from 1 - 365/366.

    Any more help...

    Thanks A Lot!


    declare @yr float, @JD float

    select @yr = 2002, @JD = 245

    select dateadd(yyyy, @yr - 1900, -1) + @JD

    --Jonathan



    --Jonathan

  • Thanks so much for all the help !!

    Thank You Mr.Larsen.

    Have a nice day.

  • Why are there so many complex queries out there to do something really simple?

    declare @Julian int

    select @Julian = datepart(dayofyear, '2003-01-01')

    Select dateadd(dd, @Julian, '12-31-2002'), @Julian

    Obviously there would have to be some decision on what the year was (stored in column, current year, whatever).

    I must be missing something...

    Signature is NULL

Viewing 3 posts - 16 through 17 (of 17 total)

You must be logged in to reply to this topic. Login to reply