Julian date string to DateTime

c#, datetime, julian-date

Solution

This is the simplest solution I can think of:

string julianDate = "13324";

int jDate = Convert.ToInt32(julianDate);
int day = jDate % 1000;
int year = (jDate - day) / 1000;
var date1 = new DateTime(year, 1, 1);
var result = date1.AddDays(day - 1);

(Note: this is all from memory; verify the syntax, etc.)

Problem

I am trying to convert Julian date string to DateTime but none of the solutions on the web seem to be working. I have a Julian date string `13324`. ``` Julian Date: 13324 ``` And I want to get the following DateTime ``` Date: 20-Nov-2013 ``` Could you please direct me in the right direction. Thanks.

Original source

Related problems