问题描述
我的WCF数据服务电话返回日期23/3/2011 6:4:55 PM 1300903495000这是不正确的。
所以我在.net中尝试了这个 - > (new DateTime(2011,3,23,18,4,55))。Ticks返回634365002950000000而不是1300903495000。
错误的1300903495000 - >新的DateTime(1300903495000)返回2/1/0001 12:08:10 pm。
经过一番了解后,我意识到要获得正确的日期,我需要这样做:再填5个右边的数字,并从基数1970添加刻度。
(新的DateTime(1970,1,1,0,0,0,0))。AddTicks((1300903495000 *) 10000));
我的问题是
- 1300903495000的返回值是否正确?
- 我的计算是否正确?
Hi,
my WCF data services call returning date 23/3/2011 6:4:55 PM as 1300903495000 which is incorrect.
so i tried this in .net -> (new DateTime(2011,3,23,18,4,55)).Ticks returns 634365002950000000 and not 1300903495000.
the incorrect 1300903495000 -> new DateTime(1300903495000) returns 2/1/0001 12:08:10 pm.
After some understanding, i realize that to get the correct date i need to do this: pad 5 more digits to the right and add tick from the base 1970.
(new DateTime(1970, 1, 1, 0, 0, 0, 0)).AddTicks((1300903495000 * 10000));
My questions are
- Is the returned value of 1300903495000 correct?
- Is my calculation correct?
这篇关于Wcf数据服务返回的Json DateTime是否错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!