sql - Cannot convert number to date -
i have problem converting number column date, did following
select to_date('12-30-1899 1:00:00','mm-dd-yyyy hh24:mi:ss') + (createdate/1440) table_a;
and got query result
10/17/5826 17:18
the month , date including hours , seconds right year different got 5826. same other rows got different results year. did follow examples on here. still got wrong result. can on thanks.
the samples below createdate column values:
1300844909778 1302831103113 1303210978316 1396963615616
date arithmetic in oracle assumes days. stands dividing large number 1440
, adding that number of days starting date. that's why you're getting results in far future.
so value createdate
represent? it's not actual date. choice of 1440
denominator suggests think it's meant "number of minutes" if dates far out of expectation not either.
i thought values represented in unix epoch because numbers start 13
. except they're way big. current unix timestamps should ten digits. you've got thirteen digits.
could unix epoch plus milliseconds?
i have created sqlfiddle test theory. treating first ten digits of createdate
values seconds , adding number unix date produces sensible dates. check out.
so theory holds water. doesn't query. adding 2 dates doesn't make sense. trying achieve? if your're looking interval need subtract earlier date later one.
Comments
Post a Comment