??????????μ??

??????????????????????????+??+?????????????????????μ??

private void GetLastDateForMonth(DateTime DtStart??out DateTime DtEnd)
{
int Dtyear??DtMonth;
DtStart = DateTime.Now;
Dtyear  = DtStart.Year;
DtMonth = DtStart.Month;
int MonthCount = DateTime.DaysInMonth(Dtyear??DtMonth);
DtEnd = Convert.ToDateTime(Dtyear.ToString()+"-"+DtMonth.ToString()+"-"+MonthCount);
}

????????????????μ??????????????

private void GetLastDateForMonth(DateTime DtStart??out DateTime DtEnd)
{
int Dtyear??DtMonth;
DtStart = DateTime.Now.AddMonths(1);
Dtyear  = DtStart.Year;
DtMonth = DtStart.Month;
DtEnd = Convert.ToDateTime(Dtyear.ToString()+"-"+DtMonth.ToString()+"-"+"1").AddDays(-1);
}

????????????????

????????????TimeSpan ????????????TimeSpan???÷?

???????????????

Add?????????TimeSpan?????
Days:???????????????TimeSpan???
Duration:???TimeSpan?????
Hours:??????С??????TimeSpan?
Milliseconds:?????ú???????TimeSpan???
Minutes:?????÷???????TimeSpan???
Negate:?????????????????
Seconds:????????????TimeSpan???
Subtract:???м???????TimeSpan???
Ticks:????TimeSpan???tick????
TotalDays:????TimeSpan????????????
TotalHours:????TimeSpan??????С?????
TotalMilliseconds:????TimeSpan?????????????
TotalMinutes:????TimeSpan?????????????
TotalSeconds:????TimeSpan????????????

???????????

DateTime d1 =new DateTime(2004??1??1??15??36??05);
DateTime d2 =new DateTime(2004??3??1??20??16??35);
TimeSpan d3 = d2.Subtract(d1);
LbTime.Text = "???:"
+d3.Days.ToString()+"??"
+d3.Hours.ToString()+"С?"
+d3.Minutes.ToString()+"????"
+d3.Seconds.ToString()+"??";

?????????????Sql?е?DATEDIFF????

??????÷?????DATEDIFF ( datepart ?? startdate ?? enddate )

???????????????????????????????????????????????С?????????????????????£?

 

???????

??д

year

yy?? yyyy

quarter

qq?? q

Month

mm?? m

dayofyear

dy?? y

Day

dd?? d

Week

wk?? ww

Hour

hh

minute

mi?? n

second

ss?? s

millisecond

ms

?????磺datediff(mi??DtOpTime??DtEnd)  ????????????????????????????????????????????????漲??λ?????????????????