DateTime dt = DateTime.Now;
Console.WriteLine(dt.ToLongDateString () + dt.ToLongTimeString() );
ChangeDate(dt);
Console.WriteLine(dt.ToLongDateString() + dt.ToLongTimeString());
//DateTime与long互转;
long tmp = dt.Ticks;
DateTime dtTmp = new DateTime(tmp);
//DateTime与double互转;
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
double tmpSecs = (DateTime.Now - startTime).TotalSeconds;
//ticks为纳秒数;
//转换为秒;
long tmpSecs1 = (DateTime.Now - startTime).Ticks / 10000000;
//获取两个DateTime只差;
DateTime dt1 = dt.AddMinutes(-10).AddSeconds (234);
double Secs = (dt - dt1).TotalSeconds ;
Secs = (dt - dt1).Ticks / 10000000;
double Mins = (dt - dt1).TotalMinutes;
double hours = (dt - dt1).TotalHours;
Console.WriteLine(dt.ToLongDateString () + dt.ToLongTimeString() );
ChangeDate(dt);
Console.WriteLine(dt.ToLongDateString() + dt.ToLongTimeString());
//DateTime与long互转;
long tmp = dt.Ticks;
DateTime dtTmp = new DateTime(tmp);
//DateTime与double互转;
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
double tmpSecs = (DateTime.Now - startTime).TotalSeconds;
//ticks为纳秒数;
//转换为秒;
long tmpSecs1 = (DateTime.Now - startTime).Ticks / 10000000;
//获取两个DateTime只差;
DateTime dt1 = dt.AddMinutes(-10).AddSeconds (234);
double Secs = (dt - dt1).TotalSeconds ;
Secs = (dt - dt1).Ticks / 10000000;
double Mins = (dt - dt1).TotalMinutes;
double hours = (dt - dt1).TotalHours;