Get month from DATETIME in sqlite

前端 未结 7 1235
温柔的废话
温柔的废话 2020-12-01 16:28

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)

7条回答
  •  有刺的猬
    2020-12-01 16:48

    This is a solution without all the case when statements. Hopefully it's helpful.

    select substr('JanFebMarAprMayJunJulAugSepOctNovDec', 1 + 3*strftime('%m', date('now')), -3)
    

提交回复
热议问题