C#: How to convert string to Julian date accordingly to the giver format?
my question is how to convert input DateTime value into Julian date format but the result should be in the format "0YYDDD"? I suppose January, 2nd 2011 should look like "011002".
Thanks
DateTime dt = new DateTime(2011, 1, 2);
Console.WriteLine( String.Format("{0:0yy0dd}",dt) );
A good cheatsheet can be found here.
Alternatively:
julianFormatString = "0" + (dateTimeVar.Year % 100).ToString() + "0" + dateTimeVar.Day.ToString();
精彩评论