2008-03-18 C# - Timestamp 與 DateTime 互轉 88415 0 .NetFramework 2008-03-23 C# - Timestamp 與 DateTime 互轉 // seconds since 1970-01-01 00:00:00 UTC // 現在時間轉秒數 double timestamp = (DateTime.Now.AddHours ( -8 ) - new DateTime( 1970, 1, 1, 0, 0, 0 ) ).TotalSeconds; // 秒數轉 DateTime DateTime dt = ( new DateTime( 1970, 1, 1, 0, 0, 0 ) ).AddHours ( 8 ).AddSeconds (timestamp); MessageBox.Show (dt.ToString ( ) ); chhuangC#.NetFramework 回首頁