开发者

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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜