C#代码将当前日期时间转换为朱利安日期... [英] C# code to convert current date time to julian date...
问题描述
亲爱的专家,
我在asp.net c#做一个项目。我被迫将日期时间转换为朱利安日期。
请帮我在C#中创建Julian Date ...我和我约会...和我需要将其转换为朱利安日期.....
例如:1994-08-25 00:00:00.000 - ---------> 1994237
谢谢..
Dilzz ......
我尝试了什么:
我试过以下项目.. 。
string _CurrentDate = String.Format({0:0yyyy0dd},DateTime.Now);
但这不正确
Dear Experts,
I am doing a project in asp.net c#. and i am stuck to convert the datetime to Julian Date.
Please help me to create Julian Date in C#... I have a datetime with me.. and i need to convert it into Julian Date.....
Eg: 1994-08-25 00:00:00.000 -----------> 1994237
Thanks..
Dilzz...
What I have tried:
I have tried the below items...
string _CurrentDate = String.Format("{0:0yyyy0dd}", DateTime.Now);
but this is not correct
推荐答案
检查一下。
check this.
var myDate = new DateTime(1994, 8, 25);
var a = string.Format("{0:yyyy}{1:D3}", myDate, myDate.DayOfYear); //1994237
参考: DateTime to JulianDate [ ^ ]
尝试:
Try:
DateTime dt = new DateTime(1994, 8, 25);
int julian = dt.Year * 1000 + dt.DayOfYear;
这篇关于C#代码将当前日期时间转换为朱利安日期...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!