https://prefect.io logo
b

Borut Hafner

01/25/2021, 1:46 PM
Dear All, I want to use a fixed point in time in my tasks. An option would be to create a task whiche returns current datetime, but i suppose that flow can offer this information in form of a flow start time. Is a way to get a flow stard date time in a task? Thanks for your answers!
1
l

Loic M

01/25/2021, 1:56 PM
Would
prefect.context.get("scheduled_start_time")
give you the information you need ?
b

Borut Hafner

01/25/2021, 2:03 PM
Yes this should be it. But as i understand it is UTC time, is it posible to get it in local time or do i have to convert it?
d

Dylan

01/25/2021, 3:55 PM
Hi @Borut Hafner! I definitely second Loic’s suggestion here. Yes, you will need to convert the timestamp yourself, but that should be a straightforward exercise in python. I personally love https://pendulum.eustace.io/
b

Borut Hafner

01/26/2021, 7:25 AM
Thanks both! I agree about conversion, but I asked just in case, if prefect provides this functionality.