Discard millisecond part from timestamp

后端 未结 3 1598
长情又很酷
长情又很酷 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:57

    if you just want time, here is the code for postgres

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

    it will return 'time without time zone' data type

提交回复
热议问题