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())

原文地址:https://www.cnblogs.com/lxhbky/p/12332812.html