mardi 13 octobre 2015

How to convert timestamp to string in SQLite?

I have table with timestamps in ms stored in it. I want to convert those timestamps in a human readable form.

Here is a sample output of my table:

SELECT date raw, strftime('%d-%m-%Y', (date/1000)) as_string
  FROM my_table

 +-----------------+--------------+
 |     raw         |  as_string   |
 +-----------------+--------------+
 |  1444687200000  |  06-47-3950  |
 +-----------------+--------------+
...               ...            ...
 +-----------------+--------------+

As you can see, the date as string is quite strange (06-47-3950).

How can I obtain 12-10-2015?

Aucun commentaire:

Enregistrer un commentaire