https://prefect.io logo
Title
m

Matt Harvey

09/14/2019, 3:11 PM
Good morning! Apologies if this is answered in the docs, I can't seem to find it. Prefect always seems to run in UTC, and so the
CronClock
needs to be set in UTC. Not a big deal, but is it possible to override the timezone? ๐Ÿ•
c

Chris White

09/14/2019, 6:27 PM
Hi Matt! Every Clock accepts a
start_date
keyword argument at initialization; if you pass a timezone-aware datetime / pendulum object, Prefect will respect that timezone for the clock / schedule. E.g.,
from prefect.schedules.clocks import CronClock  
import pendulum

clock = CronClock("0 1 0 0 1/5", start_date=pendulum.now("US/Eastern"))
next(clock.events()) 
DateTime(2020, 1, 1, 1, 0, 0, tzinfo=Timezone('US/Eastern'))
we should probably document this at the top level of the schedules / clock API documentation and as well as the concept docs
@Marvin archive โ€œCan I override the timezone of a Prefect Clock?โ€
m

Matt Harvey

09/15/2019, 10:40 PM
Brilliant, thank you, Chris!