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"));
精彩评论