Discard millisecond part from timestamp

后端 未结 3 1573
长情又很酷
长情又很酷 2020-12-01 01:22

How can I discard/round the millisecond part, better if the second part is also removed from a timestamp w/o timezone ?

3条回答
  •  失恋的感觉
    2020-12-01 01:42

    Discard milliseconds:

    SELECT DATE_TRUNC('second', CURRENT_TIMESTAMP::timestamp);
    

    2019-08-23 16:42:43

    Discard seconds:

    SELECT DATE_TRUNC('minute', CURRENT_TIMESTAMP::timestamp);
    

    2019-08-23 16:42:00

提交回复
热议问题