我有这个任务来填充这个字段:
x_fp_timestamp is the timestamp created when the form is generated. It
is equal to the number of seconds since January 1,1970 in UTC
(Coordinated Universal Time).
所以我在C#中做的是
long ts = DateTime.Now.Ticks / TimeSpan.TicksPerSecond;
但在这种情况下,我收到此错误:
- x_fp_timestamp : x_fp_timestamp invalid. Not within 15 minutes of
present time: Thu Jan 10 21:30:25 GMT 2013. Expected 1357853425
plus/minus 900,but received 63493442997.
所以我的问题是如何在几秒钟内生成当前时间戳?
解决方法
DateTime.Now.Ticks
does not start at 1970;尝试这样的事情:
(DateTime.Now.ToUniversalTime() - new DateTime (1970,1,1)).TotalSeconds