3

I'm trying to use python-dateutil to create a rrule to schedule an event to run every day at exactly 6PM EST.

The current rrule I'm using is simply:

byhour:23;

this renders to 6PM during non-daylight savings time, but during daylight savings time it renders as 7PM.

How do I change this to take into account DST?

My server this is running on (Linux) is currently configured for EST and already takes into account DST, so it looks like python-dateutil ignores this and bases calculations on UTC.

Cerin
  • 55,951
  • 85
  • 291
  • 487
  • Have you tried the suggested answer in [Get timezone used by datetime.datetime.fromtimestamp()](http://stackoverflow.com/questions/18812638/get-timezone-used-by-datetime-datetime-fromtimestamp)? – Frangipanes Aug 04 '16 at 15:44

1 Answers1

5

You should not use BYHOUR for this.

All you need is an RRULE:FREQ=DAILY but your DTSTART needs to be in local time with timezone id, not in UTC, ie something like:

DTSTART;TZID=America/New_York:20160805T180000
RRULE:FREQ=DAILY
Arnaud Quillaud
  • 4,290
  • 1
  • 11
  • 8