1.获取当前日期的年份

select to_char(t.detect_date,'YYYY')
select extract(year from now())为double precision 格式类型

select to_char((SELECT now()::timestamp),'yyyy')

2.获取下一年
select to_char((SELECT now()::timestamp+ '1 year'),'yyyy')

3.获取上一年
select to_char((SELECT now()::timestamp+ '-1 year'),'yyyy')

其他都为为 character varying格式类型
 

相关文章:

  • 2022-02-09
  • 2022-12-23
  • 2021-10-23
  • 2022-12-23
  • 2021-07-19
  • 2021-12-12
  • 2021-05-25
猜你喜欢
  • 2022-12-23
  • 2021-06-26
  • 2022-02-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案