sqlite Date Sorting

前端 未结 4 847
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-24 17:32

I am a parsing a file into a sqlite database that contains dates in the YYYY-MM-DD format. I want to store the entries into sqlite in such a way that I can sort the entries by d

4条回答
  •  野性不改
    2021-01-24 18:15

    If You want to Current TimeStamp then use

    SELECT strftime('%s','now'); 
    

    If You want toYYYY-MM-DD date TimeStamp then use

    SELECT strftime('%s','YYYY-MM-DD'); 
    

    where %s=seconds since 1970-01-01

提交回复
热议问题