how to query in sqlite for different date format

前端 未结 4 1895
北荒
北荒 2020-12-15 06:51

I am using sqlite for local database in mobile and in my database, I have date field with column name RN_CREATE_DATE. My RN_CREATE_DATE

4条回答
  •  我在风中等你
    2020-12-15 07:28

    strftime always generates four-digit years, so you have to use substr to cut off the first two digits:

    ... WHERE RN_CREATE_DATE = strftime('dd-mm-', '2012-07-28 12:04:34') ||
                               substr(strftime('%Y %H:%M:%S', '2012-07-28 12:04:34'), 3)
    

    It would be easier to store the column values in a format that is directly understood by SQLite.

提交回复
热议问题