Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 28-Apr-16 23:01pm

check this.

C#
var myDate = new DateTime(1994, 8, 25);
          var a = string.Format("{0:yyyy}{1:D3}", myDate, myDate.DayOfYear); //1994237


reference: DateTime to JulianDate[^]
 
Share this answer
 
Try:
C#
DateTime dt = new DateTime(1994, 8, 25);
int julian = dt.Year * 1000 + dt.DayOfYear;
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900