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)>
Here is my solution that worked for me
MONTH_DICT={ "Jan" : '01', "Feb" : '02', "Mar" : '03', "Apr" : '04', "May" : '05', "Jun" : '06', "Jul" : '07', "Aug" : '08', "Sep" : '09', "Oct" : 10, "Nov" : 11, "Dec" : 12 }
self.cursor.execute("SELECT * FROM error_log WHERE strftime('%m',Date_column)=?",(MONTH_DICT[query_month],))
print('output:', self.cursor.fetchall())