Using Sqlite query, Get a Date from stored milliseconds

android, android-sqlite, datetime-format, java

Solution

`Datetime` expects epochtime, which is in number of seconds while you are passing in milliseconds. Convert to seconds & apply.

SELECT datetime(1346142933585/1000, 'unixepoch');

Can verify this from this fiddle

- http://sqlfiddle.com/#!5/d41d8/223

Problem

I am using sqlite database in my application in which I am storing a Date and Time in milli-seconds. Now using Sqlite query I am trying to get this datetime from milliseconds to date in format "yyyy-MM-dd" but not getting a proper result. I want to do this using a Sqlite query. Your help will be appreciated.

Original source

Related problems