How to retrieve the Date part out of a Datetime result column in SQLite?

前端 未结 4 1987
被撕碎了的回忆
被撕碎了的回忆 2021-01-03 08:06

I have a column of datetime type from which I would like to retrieve only the date. Is there anyway to do this?

Previously it was an epoch value where I convert it t

4条回答
  •  旧巷少年郎
    2021-01-03 08:45

    You can use the DATE function.

    Example

    > select date('2011-04-26 18:40:34')
    > 2011-04-26
    

    You can get only the day with strftime,

    > select strftime('%d', '2011-04-26 18:40:34')
    > 26
    

提交回复
热议问题