将儒略日期转换为 YYYY-MM-DD [英] Convert Julian Date to YYYY-MM-DD
本文介绍了将儒略日期转换为 YYYY-MM-DD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我进行了广泛的搜索,但似乎找不到将 julian 转换为 yyyy-mm-dd
的方法.
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:
Julian 格式由年份(前两位数字)和一年中的日期(最后三位数字)组成.
The Julian format consists of the year, the first two digits, and the day within the year, the last three digits.
例如,95076
是 March 17, 1995
.95
表示年份和076
表示这是一年中的第 76 天.
For example, 95076
is March 17, 1995
. The 95
indicates the year and the
076
indicates it is the 76th day of the year.
15260
我已经试过了,但它不起作用:
I have tried this but it isn't working:
dateadd(d,(convert(int,LAST_CHANGED_DATE) % 1000)-1, convert(date,(convert(varchar,convert(int,LAST_CHANGED_DATE) /1000 + 1900) + '/1/1'))) as GrgDate
推荐答案
您可以使用 datepart()
SELECT DATEPART(yy, 95076), DATEPART(dy, 95076)
+++我误解了一些东西.这是我的更正:+++++
+++ I misunderstood something. Here's my correction: +++++
SELECT DATEADD(day, CAST(RIGHT('95076',3) AS int) – 1, CONVERT(datetime,LEFT('95076',2) + '0101', 112))
这篇关于将儒略日期转换为 YYYY-MM-DD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文