PostgreSQL 计算当年的倒计时
代码块
select '今年还有'||(t.totals-t.doy)::text||'天' as 倒计时 from (
select case when (m.year%4=0 and m.year%100!=0)or(m.year%400=0)
then 366 else 365 end as totals,
extract(doy from current_date) as doy
from(
select extract(year from current_date)::int as year
) m
) t