Skip to content

Date ranges, times and time zones

Calendar records spanning dates, timestamps, times of day, date parts and time zones.

simple volume small DatesLocalization
Languages
eng
Formats
csv

Recipe

recipe.gbddl
gbddl 1
language eng

table calendar_dates rows 12 (
  id          int64 autoincrement primarykey
  day         date date(min: "2024-01-01", max: "2024-12-31")
  at          timestamp datetime(min: "2024-01-01 00:00:00", max: "2024-12-31 23:59:59")
  time_of_day time time()
  year        int64 datetimePart(part: "year")
  month       int64 datetimePart(part: "month")
  weekday     text weekdayName()
  month_name  text monthName()
  zone        text timezone()
  zone_abbr   text timezoneAbbr()
  zone_region text timezoneRegion()
  zone_full   text timezoneFull()
  offset      float64 timezoneOffset()
)

output csv

This is the exact recipe.gbddl committed to the repository. Copy it, or download the raw source.

About this recipe

Calendar dates

A single-table recipe that generates calendar records: dates, timestamps, times of day, date parts and time zones.

What it demonstrates

  • Date and time — day is a bounded date, at a bounded timestamp, and time_of_day a time of day.
  • Date parts — year and month extract integer parts with datetimePart.
  • Calendar vocabulary — weekday and month_name are localized names.
  • Time zones — zone, zone_abbr, zone_region and zone_full describe a time zone, and offset is its UTC offset.

Run it

Submit the recipe body to POST /api/v1/jobs?input_format=gbddl, or paste it into Chef, to generate the data. The repository's local runner (run by task test) also generates it and verifies its output.

The recipe outputs one CSV table file, calendar_dates.csv, holding twelve rows.

Adapt it

  • Change language eng to another showcase language to localize the names.
  • Pin timezone() to a region for a single market.

Guarantees

Dates and timestamps stay inside the declared bounds. Values are synthetic.

Tested features

Smart types, physical types, rules and formats this recipe exercises and verifies.

datedatetimetimedatetimePartweekdayNamemonthNametimezonetimezoneAbbrtimezoneRegiontimezoneFulltimezoneOffsetautoincrementprimary-key