Help

Comparing NOW() to a certain time earlier today

Topic Labels: Formulas
1752 5
cancel
Showing results for 
Search instead for 
Did you mean: 
corb
6 - Interface Innovator
6 - Interface Innovator

I need to be able to check and see if a certain time has passed in a formula field, and I don’t think I’m doing this right. My pseudocode is:

If now is past 10:30am today, then 1, otherwise 0

What would be the best way to go about this?

5 Replies 5
IS_BEFORE(NOW(),Date)
corb
6 - Interface Innovator
6 - Interface Innovator

Thanks. How do I build the date & time desired?

How do I represent 10:30am on today?

corb
6 - Interface Innovator
6 - Interface Innovator

Bump… any thoughts?

This is trickier than you might think. You need to convert the time to your local time zone. You also need to get the time without the date.

You should also know that NOW() isn’t very accurate. It only updates periodically. In my experience it updates at best every few minutes, and at worst every few hours.

I’m also guessing that you want to do more with the formula result than just see a 1 or 0. Because someone could just look at a clock to figure that out.

IF(
    SUM(
        HOUR(
            SET_TIMEZONE(
                NOW(),
                'America/New_York'
            )
        ) * 100,
        MINUTE({Session Start Time})
    ) < 1030,
    1,
    0
)

If you are in a timezone where your offset from GMT is not in full hours, you will also need to set the timezone for the minutes.

corb
6 - Interface Innovator
6 - Interface Innovator

Huh, well if Now() isn’t accurate - is there a better suggestion?