I have this decimal 411409629.172566
and it equals 01/14/2014
. I'm working on converting some data from a competitor software and in there SQLite DB, the dates are stored as decimals like that.
In there software the date is what I put above. I have been trying to figure this date out for a couple days now. how do I convert that decimal to that date?
The following prints "1/14/2014" in my console :
new DateTime(2001, 1, 1).AddSeconds(411409629.172566).ToShortDateString()
or using equivalent SQL server syntax :
select dateadd(ss, 411409629.172566, '01-01-2001') as 'date'
... but without more samples we can't be sure this always do the correct conversion.
您可以这样尝试:
System.DateTime dt = new System.DateTime(1970, 1, 1).AddSeconds(yourDecimalValue);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.