Convert Julian Date to YYYY-MM-DD

后端 未结 8 1040
心在旅途
心在旅途 2021-01-06 16:11

I have searched far and wide, but I can\'t seem find a way to convert julian to yyyy-mm-dd.

Here is the format of my julian:

The Julian format

8条回答
  •  走了就别回头了
    2021-01-06 17:16

    You can select each part of the date using datepart()

    SELECT DATEPART(yy, 95076), DATEPART(dy, 95076)
    

    +++EDIT: I misunderstood something. Here's my correction: +++++

    SELECT DATEADD(day, CAST(RIGHT('95076',3) AS int) – 1, CONVERT(datetime,LEFT('95076',2) + '0101', 112))
    

提交回复
热议问题