Question on TimeZone library, rules with ">="

When using the TimeZone library, rules for DST are defined as:

TimeChangeRule myRule = {abbrev, week, dow, month, hour, offset};

For convenience, the following symbolic names can be used:

week: First, Second, Third, Fourth, Last
dow: Sun, Mon, Tue, Wed, Thu, Fri, Sat
month: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec

My problem is with week.

Looking at the TimeZone database, some rules are defined as:


US 2007 max - Mar Sun>=8 2:00 1:00 D
US 2007 max - Nov Sun>=1 2:00 0 S

In the "TO" column, >= means that the day of the month must be >= the number. It doesn't take a genius to figure out that Sun>=1 means "the first Sunday" and Sun>=8 means "the second Sunday".

However, it's not always that easy. The rule for Chile is:


Chile 2019 max - Apr Sun>=2 3:00u 0 -
Chile 2019 max - Sep Sun>=2 4:00u 1:00 -

So, this means that the time usually changes on the first Sunday of the month, but sometimes on the second Sunday. For example, the first Sunday in September 2024 is the 1st, so time will change there on the second Sunday.

Similarly, for Paraguay:

Para 2010 max - Oct Sun>=1 0:00 1:00 -
Para 2013 max - Mar Sun>=22 0:00 0 -

and for Israel:

Zion 2013 max - Mar Fri>=23 2:00 1:00 D
Zion 2013 max - Oct lastSun 2:00 0 S

Can such rules be defined using the TImeZone library and if so, what is the syntax?


Wow, I did a lot of research about DST and I never heard this before. I believe you, but what is your source of DST info? Who says the 1st of the month doesn't count? Why only these zones?

Oh, I'm sure you've heard of it. My explanation is probably lacking.

This is the famous "first Sunday after the first Monday".... The upcoming US elections are defined that way too. It's when "the first x" falls on the first of the month and whoever considered that to be too early.

For Israel, their law defining DST contains the phrase "the Friday before the last Sunday".

Why be easy when you can be complicated? The way the Time Zone Database lists it, using >= effectively accomplishes the same thing but is a more standardized way of stating it.

In any event, my source for the DST data comes from


The database itself is at IANA — Time Zone Database

And, by the way, this rule is easy when compared to the rules for some muslim countries where you first have to calculate Ramadan which is based on moon cycles.