💡 How-To: Dynamically Create Full-Day Time Ranges (e.g., Mon 00:00:00 to Sun 23:59:59)
Hey zenphi Community!
Ever been frustrated 🤔 trying to list items for a full day or full week?
It’s a common challenge. You want to query Salesforce, Airtable, or Google Calendar for "all of next week" or “tommorow”(from 00:00 to 23:59). But these services don't just accept a date. They need a specific date/time range 🗓️, like Monday at 00:00:00 all the way to Sunday at 23:59:59.
If you're running the flow manually, it's easy to hardcode those times. But how do you do it dynamically? How do you get that "start of day" 00:00:00 without complex functions?
There are many approaches, but here is a very straightforward, 4-step method.
The 4 Steps at a Glance
✂️ Extract Date: Isolate the date from any date/time value.
🪄 Set Time to 00:00: Convert the date string back to a date/time object set to midnight.
▶️ Define Start Range: Add days/hours to get your desired start point.
🏁 Define End Range: Add days/hours/seconds to get your desired end point.
The Step-by-Step Guide
Let's walk through how to build a range for "all of tomorrow."
Step 1: ✂️ Extract Date from Date/Time
First, we need to get just the date and ignore the time. We can use the Current Date/Time action as our input. We'll use the Format Date/Time action to turn the full date/time into a simple date-only string.
Step 2: 🪄 The "Trick" to Set Time to 00:00:00
This is the most important part. We need to turn our date string (e.g., "2025-11-13") back into a real date/time object that starts at midnight. We'll use the Convert to Date/Time action.
In the Date/Time String input, drag the token from Step 1 and then manually type a space and "00:00:00" right after it. Then, in the Format field, pick the format that matches what you just typed (e.g., yyyy-MM-dd HH:mm:ss). This tells zenphi to build the exact date/time you need.
Step 3: ▶️ Define Your Range's Start Time
Now we have a clean "start of day" (Today at 00:00:00). To get our RangeStart, we just add time to it. For our "all of tomorrow" example, we'll use the Add Time to Date/Time action to add 1 day.
Step 4: 🏁 Define Your Range's End Time
Finally, we create the RangeEnd. We'll add another Add Time to Date/Time action, but this time, we use the output from Step 3 as our input. To get the very end of the day, we'll add 23 hours, 59 minutes, and 59 seconds.
That's all! ✅ You now have two dynamic variables, RangeStart and RangeEnd, that you can use to query any system for a perfect full-day range.