In the thread can call the method repeatedly not stuck, taken from [https://blog.csdn.net/kingscoming/article/details/78847736]
New function of time
System.DateTime currentTime = new System.DateTime ();
calculated difference date
the DateTime = DT1 to Convert.ToDateTime ( "2007-8-1");
the DateTime to Convert.ToDateTime DT2 = ( "2007-8-15");
span = dt2.Subtract TimeSpan (dt1);
int dayDiff = span.Days;
the number of computing a certain period of days
int = DateTime.DaysInMonth days (2009, 8);
days = 31;
to add a day to date to reduce one day
DateTime dt = DateTime .Now;
dt.AddDays (. 1); // add a day dt does not itself alter
dt.AddDays (-1); // dt reduced one day does not itself alter
the formatted output 2016-05-09 13:09:55: 2350
dt.Tostring ( "YY") 16
dt.Tostring ( "YYYY") 2016
dt.Tostring ( "the MM") 05
dt.Tostring ( "dd") 09
dt.Tostring ( "ddd") on Monday
dt.Tostring("dddd") 星期一
dt.Tostring("hh") 01
dt.Tostring("HH") 13
dt.Tostring("mm") 09
dt.Tostring("ss") 55
dt.Tostring("ff") 23
dt.Tostring("fff") 235
dt.Tostring("ffff") 2350