PostgreSQL將日期轉為年、月、日的函數date_trunc: 當前年: select date_trunc('year',now()) 當前月: select date_trunc('month',now()) 當前日: select date_trunc('day',now()) 當前時: ...
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())