日期:2014-05-19  浏览次数:20770 次

vs2005里怎样取得本月的第一时间?
DateTime   _begin   =   new   DateTime();
_begin   =   ??????(此处为提问的)
DateTime   _end   =   new   DateTime();
_end   =   DateTime.Now;
因为我在SQL里要用到
between   @begin   and   @end
(例如between   '2007-07-01 '   and   '2007-07-5 ')
这样的语句
所以我要取到本月的一天的,零点零分零秒也能取到最好了.谢谢了

------解决方案--------------------
string MyString = "Jan 1, 2002 ";
DateTime MyDateTime = DateTime.Parse(MyString);

------解决方案--------------------
int year = DateTime.Now.Year;
int month = DateTime.Now.Month;
DateTime dt = new DateTime(year, month, 1);
------解决方案--------------------
DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + "1 "