函數是取一個時間和一個日本時間(UTC+9)對比,返回了一個秒的文本。
比如我用我機器上的本地時間(北京UTC+8),則會返回“3600”。
public static string GetNowTimeSpanSec(DateTime _time)
{
DateTime now = DateTime.UtcNow;
now = now.AddHours(9);
TimeSpan ts = now.Subtract(_time);
int sec = (int)ts.TotalSeconds;
return sec.ToString();
}