日期:2014-05-16 浏览次数:21048 次
private void Form1_Load(object sender, EventArgs e)
{
long timesecond = 1393953047;
DateTime dt = new DateTime(1970, 1, 1);
DateTime now = new DateTime(timesecond);
TimeSpan d = now - dt;
MessageBox.Show(d.ToString());
}
private void Form1_Load(object sender, EventArgs e)
{
long timesecond = 1393953047000;
DateTime dt = new DateTime(1970, 1, 1);
DateTime now = new DateTime(timesecond);
DateTime time = dt + now;
TimeSpan d = now - dt;
MessageBox.Show(time.ToString());
}
这样做貌似也不行
错误 1 运算符“+”无法应用于“System.DateTime”和“System.DateTime”类型的操作数 E:\工作区\test\test时间间隔计算\test时间间隔计算\Form1.cs 25 29 test时间间隔计算
long timesecond = (long)1393953047*10000000;// +3600 * 8;
DateTime dt = new DateTime(1970, 1, 1);
MessageBox.Show(DateTime.FromBinary(dt.ToBinary()+timesecond).ToString());