Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get month from DATETIME in sqlite

Tags:

sql

sqlite

I am trying to get extract the month from a DATETIME field in SQLite. month(dateField) does not work as well as strftime('%m', dateStart).

Any ideas?

like image 451
Ilija Avatar asked Mar 16 '09 13:03

Ilija


2 Answers

I don't understand, the response is in your question :

select strftime('%m', dateField) as Month ... 
like image 175
MarmouCorp Avatar answered Sep 23 '22 11:09

MarmouCorp


SELECT strftime('%m', datefield) FROM table  

If you are searching the month name, text month names does not seems to be supported by the core distribution of SQLite

like image 41
Jhonny D. Cano -Leftware- Avatar answered Sep 23 '22 11:09

Jhonny D. Cano -Leftware-