Hi Prefect folks. Quick question. Does the prefe...
# prefect-community
m
Hi Prefect folks. Quick question. Does the prefect.context.today variable respect the timezone as specified when instantiating a Schedule?
z
Hi Marco — they are always UTC. From the flow runner code:
Copy code
now = pendulum.now("utc")
        dates = {
            "date": now,
            "today": now.strftime("%Y-%m-%d"),
            "yesterday": now.add(days=-1).strftime("%Y-%m-%d"),
            "tomorrow": now.add(days=1).strftime("%Y-%m-%d"),
            "today_nodash": now.strftime("%Y%m%d"),
            "yesterday_nodash": now.add(days=-1).strftime("%Y%m%d"),
            "tomorrow_nodash": now.add(days=1).strftime("%Y%m%d"),
        }
m
Thanks!
j
Yup, one additional note - that
date
variable in context is a pendulum object, so you could load it into any time zone. I think you’d do something like this:
Copy code
prefect.context.date.in_tz('EST')
👍 1
m
@Jeremiah is date "now"?
j
yes
Just in a format you can manipulate to a different timezone if you choose
m
perfect
thanks