Skip to content

Calendar

Public holidays and business days for hundreds of countries, plus Easter, ISO weeks, and RRULE recurrences

Connector software
Free and open source
Service credentials
Not needed
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/calendar/index.md to help me query Calendar with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

weekly-recurrence

Example output Β· captured
Connector release
v0.6.0
Engine
2.0.1
VGI protocol
3.4.0
SELECT seq, occurrence
FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=WEEKLY;COUNT=4')
ORDER BY seq;
Result
seq occurrence
0 2026-01-01 00:00
1 2026-01-08 00:00
2 2026-01-15 00:00
3 2026-01-22 00:00

Quick start

Choose where to run Calendar, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'cal' AS cal (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-calendar-worker'
);

3. Run a query

query.sql
SELECT seq, occurrence
FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=WEEKLY;COUNT=4')
ORDER BY seq;
More example queries β†’
Technical details
Verified connector release
v0.6.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'cal' AS cal (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-calendar-worker'
);

Overview

Holiday, business-day, and recurrence calendar math for SQL

Catalog

Everything cal exposes once attached β€” read straight from the worker's released build.

cal 1 schema
main 1 table Β· 11 functions

Holiday, business-day, and recurrence functions plus the supported-countries table

Schema examples (18)
Examples (18)

Is Christmas 2026 a US public holiday?

SELECT cal.main.is_holiday(DATE '2026-12-25') AS is_holiday;

Name of the US holiday on 4 July 2026.

SELECT cal.main.holiday_name(DATE '2026-07-04') AS holiday_name;

Is Christmas 2026 a US business day?

SELECT cal.main.is_business_day(DATE '2026-12-25') AS is_business_day;

Two US business days after 24 December 2026 (skips Christmas + weekend).

SELECT cal.main.add_business_days(DATE '2026-12-24', 2) AS due;
14 more examples

How many US business days fall in January 2026.

SELECT cal.main.business_days_between(DATE '2026-01-01', DATE '2026-02-01') AS n;

Western Easter Sunday in 2026.

SELECT cal.main.easter(2026) AS easter_sunday;

ISO-8601 year-week label for 22 June 2026.

SELECT cal.main.iso_year_week(DATE '2026-06-22') AS iso_year_week;

US + California public holidays in 2026, projected and ordered.

SELECT date, name
FROM cal.main.holidays(2026, country := 'US', subdiv := 'CA')
ORDER BY date;

The first four weekly occurrences from 1 January 2026.

SELECT seq, occurrence
FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=WEEKLY;COUNT=4')
ORDER BY seq;
Result
seq occurrence
0 2026-01-01 00:00
1 2026-01-08 00:00
2 2026-01-15 00:00
3 2026-01-22 00:00

US business days in the 2026 year-end week, in order.

SELECT date
FROM cal.main.business_days(DATE '2026-12-21', DATE '2026-12-31', country := 'US')
ORDER BY date;

How many distinct countries the holiday functions support.

SELECT count(DISTINCT country) AS countries
FROM cal.main.supported_countries;

Payment calendar: 1st-of-month 2026 payments from rrule, rolled forward to the next US business day when the 1st is not one, with the reason: the holiday name, or the weekday for weekend rolls.

WITH sched AS (SELECT r.seq, CAST(r.occurrence AS DATE) AS due FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=MONTHLY;BYMONTHDAY=1;COUNT=12') AS r) SELECT due, CASE WHEN cal.main.is_business_day(due) THEN due ELSE cal.main.add_business_days(due, 1) END AS settles_on, CASE WHEN NOT cal.main.is_business_day(due) THEN coalesce(cal.main.holiday_name(due), dayname(due)) END AS rolled_because
FROM sched
ORDER BY seq;

Capacity plan: US business days per month in 2026, with the holidays that fell on a weekday and so removed a working day (weekend holidays such as Saturday 4 July are left out).

WITH bd AS (SELECT date_trunc('month', date) AS month, count(*) AS business_days FROM cal.main.business_days(DATE '2026-01-01', DATE '2026-12-31', country := 'US') GROUP BY ALL), lost AS (SELECT date_trunc('month', date) AS month, count(*) AS weekday_holidays, string_agg(name, ', ' ORDER BY date) AS holiday_names FROM cal.main.holidays(2026, country := 'US') WHERE isodow(date) <= 5 GROUP BY ALL) SELECT strftime(bd.month, '%Y-%m') AS month, bd.business_days, coalesce(lost.weekday_holidays, 0) AS weekday_holidays, lost.holiday_names
FROM bd
LEFT JOIN lost USING (month)
ORDER BY bd.month;

Cross-border settlement window: the days from 21 Dec 2026 to 8 Jan 2027 when both the US and the UK (GB) are open, i.e. US business days that are also GB business days.

SELECT b.date, dayname(b.date) AS weekday
FROM cal.main.business_days(DATE '2026-12-21', DATE '2027-01-08', country := 'US') AS b
WHERE cal.main.is_business_day(b.date, 'GB')
ORDER BY b.date;

Sprint capacity: US business days in each ISO week from 30 Nov 2026 to 10 Jan 2027, labelled with iso_year_week (Christmas and New Year's Day cut W52 and W53 to 4 days).

SELECT cal.main.iso_year_week(b.date) AS iso_week,
  count(*) AS business_days, min(b.date) AS first_day,
  max(b.date) AS last_day
FROM cal.main.business_days(DATE '2026-11-30', DATE '2027-01-10', country := 'US') AS b
GROUP BY ALL
ORDER BY iso_week;

Countdown: the US holidays on or after 13 November 2026, with how many US business days remain until each (business_days_between counts [start, end)).

SELECT h.date, h.name,
  cal.main.business_days_between(DATE '2026-11-13', h.date) AS business_days_away
FROM cal.main.holidays(2026, country := 'US') AS h
WHERE h.date >= DATE '2026-11-13'
ORDER BY h.date;

Moveable feasts: the German holidays whose offset from easter() is the same in 2025, 2026 and 2027, i.e. the Easter-anchored ones, with that offset in days. Fixed-date holidays such as Labor Day drop out.

WITH h AS (SELECT date, name FROM cal.main.holidays(2025, country := 'DE') UNION ALL SELECT date, name FROM cal.main.holidays(2026, country := 'DE') UNION ALL SELECT date, name FROM cal.main.holidays(2027, country := 'DE')) SELECT name, min(date - cal.main.easter(year(date))) AS days_from_easter
FROM h
GROUP BY name
HAVING count(*) = 3 AND count(DISTINCT date - cal.main.easter(year(date))) = 1
ORDER BY days_from_easter;

Cross-border closures: the 2026 dates that are a public holiday in both the US and GB, with each country's holiday name.

SELECT us.date, us.name AS us_holiday, gb.name AS gb_holiday
FROM cal.main.holidays(2026, country := 'US') AS us
JOIN cal.main.holidays(2026, country := 'GB') AS gb ON us.date = gb.date
ORDER BY us.date;
Tables
supported_countries 2 examples2 cols

Discovery table of every (country, subdivision) the holiday/business-day functions accept.

Columns
countrynot null VARCHAR
ISO-3166 alpha-2 country code (e.g. 'US', 'GB').
subdivisionnot null VARCHAR
Subdivision / state / province code, or the empty string for a country-level entry.
ConstraintsPRIMARY KEY (country, subdivision)
Examples (2)

How many countries are supported.

SELECT count(DISTINCT country) FROM cal.main.supported_countries;

German subdivisions (BundeslΓ€nder).

SELECT subdivision FROM cal.main.supported_countries WHERE country = 'DE';
Link
Scalar functions
add_business_days (date DATE, n INTEGER, country VARCHAR, subdiv VARCHAR) +2 overloads 4 examples

Advance a date by N business days, skipping weekends + holidays (country 'US')

Arguments
date DATE
Calendar day to advance from.
n INTEGER
Business days to add (negative goes backwards).
country VARCHAR
ISO-3166 alpha-2 country code, e.g. 'US', 'GB'.
subdiv VARCHAR
Subdivision / state code, e.g. 'CA', 'NY'.
Overloads
add_business_days(date DATE, n INTEGER) β†’ DATEadd_business_days(date DATE, n INTEGER, country VARCHAR) β†’ DATEadd_business_days(date DATE, n INTEGER, country VARCHAR, subdiv VARCHAR) β†’ DATE
ReturnsDATE
Examples (4)

Two business days after 2026-12-24 (skips Christmas + weekend)

SELECT cal.main.add_business_days(DATE '2026-12-24', 2);

Two UK business days after 2026-12-24

SELECT cal.main.add_business_days(DATE '2026-12-24', 2, 'GB');

Two California business days after 2026-03-30 (skips Cesar Chavez Day)

SELECT cal.main.add_business_days(DATE '2026-03-30', 2, 'US', 'CA');
1 more example

Payment calendar: 1st-of-month 2026 payments from rrule, rolled forward to the next US business day when the 1st is not one, with the reason: the holiday name, or the weekday for weekend rolls.

WITH sched AS (SELECT r.seq, CAST(r.occurrence AS DATE) AS due FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=MONTHLY;BYMONTHDAY=1;COUNT=12') AS r) SELECT due, CASE WHEN cal.main.is_business_day(due) THEN due ELSE cal.main.add_business_days(due, 1) END AS settles_on, CASE WHEN NOT cal.main.is_business_day(due) THEN coalesce(cal.main.holiday_name(due), dayname(due)) END AS rolled_because
FROM sched
ORDER BY seq;
Link
business_days_between (start DATE, end DATE, country VARCHAR, subdiv VARCHAR) +2 overloads 4 examples

Count business days in [start, end) (start inclusive; country defaults to 'US')

Arguments
start DATE
Inclusive lower bound of the span to count over.
end DATE
Exclusive upper bound of the span to count over.
country VARCHAR
ISO-3166 alpha-2 country code, e.g. 'US', 'GB'.
subdiv VARCHAR
Subdivision / state code, e.g. 'CA', 'NY'.
Overloads
business_days_between(start DATE, end DATE) β†’ INTEGERbusiness_days_between(start DATE, end DATE, country VARCHAR) β†’ INTEGERbusiness_days_between(start DATE, end DATE, country VARCHAR, subdiv VARCHAR) β†’ INTEGER
ReturnsINTEGER
Examples (4)

Business days in January 2026

SELECT cal.main.business_days_between(DATE '2026-01-01', DATE '2026-02-01');

UK business days in January 2026

SELECT cal.main.business_days_between(DATE '2026-01-01', DATE '2026-02-01', 'GB');

California business days in March 2026 (excludes Cesar Chavez Day)

SELECT cal.main.business_days_between(DATE '2026-03-01', DATE '2026-04-01', 'US', 'CA');
1 more example

Countdown: the US holidays on or after 13 November 2026, with how many US business days remain until each (business_days_between counts [start, end)).

SELECT h.date, h.name,
  cal.main.business_days_between(DATE '2026-11-13', h.date) AS business_days_away
FROM cal.main.holidays(2026, country := 'US') AS h
WHERE h.date >= DATE '2026-11-13'
ORDER BY h.date;
Link
easter (year BIGINT) 3 examples

Western (Gregorian) Easter Sunday for a year

Arguments
year BIGINT
Year (e.g. 2026)
ReturnsDATE
Examples (3)

Easter Sunday in 2026

SELECT cal.main.easter(2026);

Days from that year's Easter Sunday (easter accepts year(d) directly)

SELECT d, d - cal.main.easter(year(d)) AS days_from_easter
FROM (VALUES (DATE '2026-04-03'), (DATE '2027-05-06')) AS t(d)
ORDER BY d;

Moveable feasts: the German holidays whose offset from easter() is the same in 2025, 2026 and 2027, i.e. the Easter-anchored ones, with that offset in days. Fixed-date holidays such as Labor Day drop out.

WITH h AS (SELECT date, name FROM cal.main.holidays(2025, country := 'DE') UNION ALL SELECT date, name FROM cal.main.holidays(2026, country := 'DE') UNION ALL SELECT date, name FROM cal.main.holidays(2027, country := 'DE')) SELECT name, min(date - cal.main.easter(year(date))) AS days_from_easter
FROM h
GROUP BY name
HAVING count(*) = 3 AND count(DISTINCT date - cal.main.easter(year(date))) = 1
ORDER BY days_from_easter;
Link
holiday_name (date DATE, country VARCHAR, subdiv VARCHAR) +2 overloads 3 examples

Public-holiday name on a date, or NULL (country defaults to 'US')

Arguments
date DATE
Calendar day to evaluate.
country VARCHAR
ISO-3166 alpha-2 country code, e.g. 'US', 'GB'.
subdiv VARCHAR
Subdivision / state code, e.g. 'CA', 'NY'.
Overloads
holiday_name(date DATE) β†’ VARCHARholiday_name(date DATE, country VARCHAR) β†’ VARCHARholiday_name(date DATE, country VARCHAR, subdiv VARCHAR) β†’ VARCHAR
ReturnsVARCHAR
Examples (3)

Name of the US holiday on 2026-07-04

SELECT cal.main.holiday_name(DATE '2026-07-04');

Name of the UK holiday on Christmas 2026

SELECT cal.main.holiday_name(DATE '2026-12-25', 'GB');

Name of the California holiday on 2026-03-31

SELECT cal.main.holiday_name(DATE '2026-03-31', 'US', 'CA');
Link
is_business_day (date DATE, country VARCHAR, subdiv VARCHAR) +2 overloads 4 examples

True if a date is a weekday and not a public holiday (country defaults to 'US')

Arguments
date DATE
Calendar day to evaluate.
country VARCHAR
ISO-3166 alpha-2 country code, e.g. 'US', 'GB'.
subdiv VARCHAR
Subdivision / state code, e.g. 'CA', 'NY'.
Overloads
is_business_day(date DATE) β†’ BOOLEANis_business_day(date DATE, country VARCHAR) β†’ BOOLEANis_business_day(date DATE, country VARCHAR, subdiv VARCHAR) β†’ BOOLEAN
ReturnsBOOLEAN
Examples (4)

Is Christmas 2026 a business day?

SELECT cal.main.is_business_day(DATE '2026-12-25');

Is Christmas 2026 a UK business day?

SELECT cal.main.is_business_day(DATE '2026-12-25', 'GB');

Is Cesar Chavez Day a California business day?

SELECT cal.main.is_business_day(DATE '2026-03-31', 'US', 'CA');
1 more example

Cross-border settlement window: the days from 21 Dec 2026 to 8 Jan 2027 when both the US and the UK (GB) are open, i.e. US business days that are also GB business days.

SELECT b.date, dayname(b.date) AS weekday
FROM cal.main.business_days(DATE '2026-12-21', DATE '2027-01-08', country := 'US') AS b
WHERE cal.main.is_business_day(b.date, 'GB')
ORDER BY b.date;
Link
is_holiday (date DATE, country VARCHAR, subdiv VARCHAR) +2 overloads 3 examples

True if a date is a public holiday (country defaults to 'US')

Arguments
date DATE
Calendar day to evaluate.
country VARCHAR
ISO-3166 alpha-2 country code, e.g. 'US', 'GB'.
subdiv VARCHAR
Subdivision / state code, e.g. 'CA', 'NY'.
Overloads
is_holiday(date DATE) β†’ BOOLEANis_holiday(date DATE, country VARCHAR) β†’ BOOLEANis_holiday(date DATE, country VARCHAR, subdiv VARCHAR) β†’ BOOLEAN
ReturnsBOOLEAN
Examples (3)

Is Christmas 2026 a (US) holiday?

SELECT cal.main.is_holiday(DATE '2026-12-25');

Is Christmas 2026 a UK holiday?

SELECT cal.main.is_holiday(DATE '2026-12-25', 'GB');

Cesar Chavez Day is a California holiday

SELECT cal.main.is_holiday(DATE '2026-03-31', 'US', 'CA');
Link
iso_week (date DATE) 1 example

ISO-8601 week number (1..53) for a date

Arguments
date DATE
Calendar day whose ISO week to report.
ReturnsINTEGER
Example

ISO week of a date

SELECT cal.main.iso_week(DATE '2026-06-22');
Link
iso_year_week (date DATE) 2 examples

ISO-8601 year-week label, e.g. '2026-W26'

Arguments
date DATE
Calendar day whose ISO week to report.
ReturnsVARCHAR
Examples (2)

ISO year-week label of a date

SELECT cal.main.iso_year_week(DATE '2026-06-22');

Sprint capacity: US business days in each ISO week from 30 Nov 2026 to 10 Jan 2027, labelled with iso_year_week (Christmas and New Year's Day cut W52 and W53 to 4 days).

SELECT cal.main.iso_year_week(b.date) AS iso_week,
  count(*) AS business_days, min(b.date) AS first_day,
  max(b.date) AS last_day
FROM cal.main.business_days(DATE '2026-11-30', DATE '2027-01-10', country := 'US') AS b
GROUP BY ALL
ORDER BY iso_week;
Link
Table functions
business_days (start DATE, end DATE, country := VARCHAR, subdiv := VARCHAR) 5 examples

Every business day in an inclusive [start, end] range

Positional arguments
start DATE
Range start (inclusive).
end DATE
Range end (inclusive).
Named arguments
country := VARCHAR
ISO-3166 alpha-2 country code (e.g. 'US', 'GB'). Β· default "US"
subdiv := VARCHAR
Optional subdivision / state code (e.g. 'CA', 'NY'). Β· default null
Returns columns
date DATE
A business day in the range.
Examples (5)

How many US business days fall in the 2026 year-end week (Christmas excluded)

SELECT count(*) AS business_days
FROM cal.main.business_days(DATE '2026-12-21', DATE '2026-12-31', country := 'US');

The US business days of the 2026 year-end week, in order

SELECT date
FROM cal.main.business_days(DATE '2026-12-21', DATE '2026-12-31', country := 'US')
ORDER BY date;

Capacity plan: US business days per month in 2026, with the holidays that fell on a weekday and so removed a working day (weekend holidays such as Saturday 4 July are left out).

WITH bd AS (SELECT date_trunc('month', date) AS month, count(*) AS business_days FROM cal.main.business_days(DATE '2026-01-01', DATE '2026-12-31', country := 'US') GROUP BY ALL), lost AS (SELECT date_trunc('month', date) AS month, count(*) AS weekday_holidays, string_agg(name, ', ' ORDER BY date) AS holiday_names FROM cal.main.holidays(2026, country := 'US') WHERE isodow(date) <= 5 GROUP BY ALL) SELECT strftime(bd.month, '%Y-%m') AS month, bd.business_days, coalesce(lost.weekday_holidays, 0) AS weekday_holidays, lost.holiday_names
FROM bd
LEFT JOIN lost USING (month)
ORDER BY bd.month;
2 more examples

Cross-border settlement window: the days from 21 Dec 2026 to 8 Jan 2027 when both the US and the UK (GB) are open, i.e. US business days that are also GB business days.

SELECT b.date, dayname(b.date) AS weekday
FROM cal.main.business_days(DATE '2026-12-21', DATE '2027-01-08', country := 'US') AS b
WHERE cal.main.is_business_day(b.date, 'GB')
ORDER BY b.date;

Sprint capacity: US business days in each ISO week from 30 Nov 2026 to 10 Jan 2027, labelled with iso_year_week (Christmas and New Year's Day cut W52 and W53 to 4 days).

SELECT cal.main.iso_year_week(b.date) AS iso_week,
  count(*) AS business_days, min(b.date) AS first_day,
  max(b.date) AS last_day
FROM cal.main.business_days(DATE '2026-11-30', DATE '2027-01-10', country := 'US') AS b
GROUP BY ALL
ORDER BY iso_week;
Link
holidays (year BIGINT, country := VARCHAR, subdiv := VARCHAR) 7 examples

All public holidays in a year (date, name, observed)

Positional arguments
year BIGINT
Calendar year (e.g. 2026).
Named arguments
country := VARCHAR
ISO-3166 alpha-2 country code (e.g. 'US', 'GB'). Β· default "US"
subdiv := VARCHAR
Optional subdivision / state code (e.g. 'CA', 'NY'). Β· default null
Returns columns
date DATE
Holiday date.
name VARCHAR
Holiday name.
observed BOOLEAN
True if this row is an observed-day shift (e.g. a weekend holiday observed on an adjacent weekday).
Examples (7)

Every US public holiday in 2026, as (date, name) ordered by date

SELECT date, name
FROM cal.main.holidays(2026, country := 'US')
ORDER BY date;

US + California holidays in 2026, ordered by date

SELECT date, name
FROM cal.main.holidays(2026, country := 'US', subdiv := 'CA')
ORDER BY date;

Countdown: the US holidays on or after 13 November 2026, with how many US business days remain until each (business_days_between counts [start, end)).

SELECT h.date, h.name,
  cal.main.business_days_between(DATE '2026-11-13', h.date) AS business_days_away
FROM cal.main.holidays(2026, country := 'US') AS h
WHERE h.date >= DATE '2026-11-13'
ORDER BY h.date;
4 more examples

Moveable feasts: the German holidays whose offset from easter() is the same in 2025, 2026 and 2027, i.e. the Easter-anchored ones, with that offset in days. Fixed-date holidays such as Labor Day drop out.

WITH h AS (SELECT date, name FROM cal.main.holidays(2025, country := 'DE') UNION ALL SELECT date, name FROM cal.main.holidays(2026, country := 'DE') UNION ALL SELECT date, name FROM cal.main.holidays(2027, country := 'DE')) SELECT name, min(date - cal.main.easter(year(date))) AS days_from_easter
FROM h
GROUP BY name
HAVING count(*) = 3 AND count(DISTINCT date - cal.main.easter(year(date))) = 1
ORDER BY days_from_easter;

Cross-border closures: the 2026 dates that are a public holiday in both the US and GB, with each country's holiday name.

SELECT us.date, us.name AS us_holiday, gb.name AS gb_holiday
FROM cal.main.holidays(2026, country := 'US') AS us
JOIN cal.main.holidays(2026, country := 'GB') AS gb ON us.date = gb.date
ORDER BY us.date;
SELECT * FROM cal.main.holidays(2026, country := 'US') ORDER BY date;
SELECT count(*) AS n FROM cal.main.holidays(2026, country := 'US');
Link
rrule (dtstart TIMESTAMP, rule VARCHAR, count := INTEGER, until := TIMESTAMP) 3 examples

Expand an RFC-5545 recurrence rule (dateutil) into timestamps

Positional arguments
dtstart TIMESTAMP
First instant of the recurrence.
rule VARCHAR
RFC-5545 RRULE body or full string.
Named arguments
count := INTEGER
Max occurrences (0 returns no rows). Β· default null
until := TIMESTAMP
Upper bound (inclusive). Β· default null
Returns columns
seq BIGINT
0-based occurrence index.
occurrence TIMESTAMP
Occurrence timestamp.
Examples (3)

The first four weekly occurrences from 2026-01-01, indexed and ordered

SELECT seq, occurrence
FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=WEEKLY;COUNT=4')
ORDER BY seq;
Result
seq occurrence
0 2026-01-01 00:00
1 2026-01-08 00:00
2 2026-01-15 00:00
3 2026-01-22 00:00

The first of every month in 2026, as (seq, occurrence) ordered by seq

SELECT seq, occurrence
FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=MONTHLY;BYMONTHDAY=1', until := TIMESTAMP '2026-12-31')
ORDER BY seq;

Payment calendar: 1st-of-month 2026 payments from rrule, rolled forward to the next US business day when the 1st is not one, with the reason: the holiday name, or the weekday for weekend rolls.

WITH sched AS (SELECT r.seq, CAST(r.occurrence AS DATE) AS due FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=MONTHLY;BYMONTHDAY=1;COUNT=12') AS r) SELECT due, CASE WHEN cal.main.is_business_day(due) THEN due ELSE cal.main.add_business_days(due, 1) END AS settles_on, CASE WHEN NOT cal.main.is_business_day(due) THEN coalesce(cal.main.holiday_name(due), dayname(due)) END AS rolled_because
FROM sched
ORDER BY seq;
Link

Try these queries

is-christmas-a-holiday β€” Whether 25 December 2026 is a US public holiday.

SELECT cal.main.is_holiday(DATE '2026-12-25') AS is_holiday;

Uses is_holiday

add-business-days β€” Two US business days after 24 December 2026 (skips Christmas + weekend).

SELECT cal.main.add_business_days(DATE '2026-12-24', 2) AS due;

Uses add_business_days

settlement-schedule-following β€” Payment calendar: 1st-of-month 2026 payments from rrule, rolled forward to the next US business day when the 1st is not one, with the reason: the holiday name, or the weekday for weekend rolls.

WITH sched AS (SELECT r.seq, CAST(r.occurrence AS DATE) AS due FROM cal.main.rrule(TIMESTAMP '2026-01-01', 'FREQ=MONTHLY;BYMONTHDAY=1;COUNT=12') AS r) SELECT due, CASE WHEN cal.main.is_business_day(due) THEN due ELSE cal.main.add_business_days(due, 1) END AS settles_on, CASE WHEN NOT cal.main.is_business_day(due) THEN coalesce(cal.main.holiday_name(due), dayname(due)) END AS rolled_because
FROM sched
ORDER BY seq;

Uses rruleis_business_dayadd_business_daysholiday_name

Name of the US holiday on 4 July 2026.

SELECT cal.main.holiday_name(DATE '2026-07-04') AS holiday_name

Uses holiday_name

Is Christmas 2026 a US business day?

SELECT cal.main.is_business_day(DATE '2026-12-25') AS is_business_day

Uses is_business_day

How many US business days fall in January 2026.

SELECT cal.main.business_days_between(DATE '2026-01-01', DATE '2026-02-01') AS n

Uses business_days_between

37 more examples in the Catalog, each listed under the table or function it uses.

Questions it can answer

Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.

  • Using the cal worker, what is the ISO 8601 year-week label (ISO year and week number) for 1 January 2027? Return the single label string the worker produces.
  • Using the cal worker, what is the name of the public holiday in Japan (country code 'JP') on 4 May 2026? Return the single holiday name.
  • Using the cal calendar worker, is 4 July 2026 a public holiday in the United States (country code 'US')? Return a single boolean value.
  • Using the cal worker, on what calendar date does Western (Gregorian) Easter Sunday fall in 2027? Return a single date.
  • Using the cal worker, what is the ISO-8601 week number (a value from 1 to 53) that contains 3 January 2027? Return a single integer.

Calendar is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.