I need a simple way to get today's date and yesterday's date

I am pinging an API every night at midnight.

I only want to get the prior days data, and need to have a filter added on the back end of the URL

[url]/?filter=start_time%20%3E%20%272024-12-01T00%3A00%3A00Z%27%20AND%20start_time%20%3C%20%272024-12-13T00%3A00%3A00Z%27%20’

Translated | start_time > ‘2024-12-01T00:00:00Z’ AND start_time < ‘2024-12-13T00:00:00Z

How do I get the dates in an easy way?

I use the DateTime - Current Time module to do that. You can use it to offset the day/time however you need and specify the output format. If you need it to be exactly T and Z and not the actual am/pm and timezones, i would just do the yyyy-mm-dd format from the datetime module and then concat it with ‘T00:00:00Z’ using a text builder
image

do this for each time you need

1 Like