开发者

Convert DateTime to yyyyMMdd int

What is the quickest way to convert a DateTime to a int representation of the format yyyyMMdd.

i.e. 01-Jan-2007 --> 20070101 (as i开发者_JS百科n int)?


int x = date.Year * 10000 + date.Month * 100 + date.Day


int result = int.Parse(myDate.ToString("yyyyMMdd"));
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜