Roy Sigurd Karlsbakk wrote:
> Trying to use strftime() to extract current Year-Month seems to go nuts.
>
> sqlite> select strftime('%s', 'now');
> 1413536061
> sqlite> select strftime('%Y-%m', strftime('%s', 'now'));
> 3865-46

SQLite interprets a number as a Julian day number.  To have it
interpreted as second requires the "unixepoch" modifier:

  sqlite> select strftime('%Y-%m', strftime('%s', 'now'), 'unixepoch');
  2014-10

Anyway, there's no reason to call strftime() twice:

  sqlite> select strftime('%Y-%m', 'now');
  2014-10


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to