Forum Academy Marketplace Showcase Pricing Features

Only when date and time matches

I want the “only when” to check if DateTimePicker start’s value (date AND time) and DateTimePicker’s Date_initial_saved matches. I tried the “formatted as 10/20/2021” but I realized it caused a bug where the DTP start’s and Date_initial_saved values were considered matches when it wasn’t supposed to because it checked ONLY the date and not the time. How do I make the “only when” constraint check the time as well?

Anyone?

When you’re comparing two dates there’s no need to use formatted as (that will just convert the dates into text).

What exactly is the problem you’re having? Is it not working as expected?

Does your date/time picker have a time selection? Or just a date?

The date/time picker will save down the time stamp I believe - it will display as date and time in the database though. But this basically saves it to the second or millisecond.

You need to decide what level you want it to match on. To the date, the hour, minute, the second etc.

Once you have decided what level you are wanting to match down to - say it’s just the hour.

You would use date/time picker’s starts value change seconds to 0, change minutes to 0 is not X date/time’s value change seconds to 0, change minutes to 0.

I want the “only when” constraint to also consider the time, not just the date. If I don’t format it, the option “is” is missing (see screenshot below):

since the option “is” is missing, I can’t make the only when constraint to check if the time is also matching or not

I want to match it by the hour

I chose the option change hours to 0. What should I do next?

Yes my Date/time pickers have a time selection as well

You don’t want to change hour to 0 - that will match only on date.

Go read my post again, instructions are there for matching on hour :slight_smile:

1 Like

Yeah I’m really sorry I didn’t understand it at first, but the option “is” or “is not” is also missing

Nevermind, I found out how to do it.

For anyone interested to know, the solution I found was “only when DateTimePicker x’s value - DateTimePicker y’s value:format as hours is (or is not) 0”.

This way, both values are converted to the hour and subtracted then of course if the final result is zero, it means both date/times match, and if it isn’t zero, they don’t match.

Oh and huge thanks to @equibodyapp and @adamhholmes for helping out.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.