How to convert milliseconds to date in SQLite

后端 未结 3 1761
一整个雨季
一整个雨季 2020-12-01 12:32

I store date from Calendar.getTimeInMilliseconds() in SQLite DB. I need to mark first rows by every month in SELECT statement, so I need convert time in milliseconds into an

3条回答
  •  半阙折子戏
    2020-12-01 13:05

    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

提交回复
热议问题