Convert Julian Date to YYYY-MM-DD

后端 未结 8 1134
心在旅途
心在旅途 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 16:53

    This will definitely work in all case.

    DECLARE @date int
    SET @date = 21319
    SELECT DATEADD(dd, RIGHT(@date,LEN(@date)-3)-1, DATEADD(yy,LEFT(@date,1)*100 +RIGHT(LEFT(@date,3),2),'1 Jan 1900'))
    

提交回复
热议问题