PostgreSQL 中是否有内置功能可以检查该日期是否为美国联邦假日?例如,如果日期是/曾经是联邦假日,则返回 bool 值 true。
最佳答案
您可以从这里获取列表:
create table public.federal_holidays (id int not null primary key, date date not null unique, description text);
copy public.federal_holidays from program 'curl -s https://gist.githubusercontent.com/shivaas/4758439/raw/b0d3ddec380af69930d0d67a9e0519c047047ff8/US%2520Bank%2520holidays'
with (format csv, header false);
然后查询它:
select exists (select 1 from public.federal_holidays where date = 'today') as today_is_a_public_holiday
关于sql - PostgreSQL 是否有内置功能来查找美国联邦假日?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37194387/