PostgreSQL将日期转为当前年、月、日的函数date_trunc

  PostgreSQL将日期转为年、月、日的函数date_trunc:

  当前年:  select  date_trunc('year',now())

  当前月:  select  date_trunc('month',now())

  当前日:  select  date_trunc('day',now())

  当前时:  select  date_trunc('hour',now())

  当前分:  select  date_trunc('minute',now())

  当前秒:  select  date_trunc('second',now())

posted @ 2020-11-23 08:20  山上一边边  阅读(3811)  评论(0编辑  收藏  举报