Convert Julian Date to YYYY-MM-DD

后端 未结 8 1042
心在旅途
心在旅途 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:08

    I concatenated 20 to my JD and then ran DATEADD(YEAR, LAST_CHANGE_DATE / 1000 - 1900, LAST_CHANGE_DATE % 1000 - 1)

    this got me the result. Thank you!!!

    0 讨论(0)
  • 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))
    
    0 讨论(0)
提交回复
热议问题