Skip to content

jaysobel/sql-cron-to-timestamps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 

Repository files navigation

Snowflake SQL Cron to Timestamps

Takes one or more rows containing cron schedule expressions and outputs all their matching timestamps within specified years.

Written in Snowflake SQL, which provides handy functions like last_day('2022-02-01'::date) -- 28. I could have made better use of split_to_table, but I like joining to numbers, and it's also closer to being cross-compatible.

I have not verified the accuracy of the output, but it is quite quick!

Based on the rules described in crontab guru.

Brief explanation on day-of-month (position 3) and day-of-week (position 5) being combined with logical OR when they are both restricted (not wildcarded, and specifically only checking for a wildcard in the first character; eg */2 vs 1,*/2). The Crontab spec does not clarify this case, but crontab guru has a good write up on the so-called crontab bug which relates to only checking the first character for a wildcard.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published