If Condition, Time is between

Hi there, can someone educate me on how I should use the If condition function for if Time is between 2 times. How do I define the start and end time on the columns?

Thanks

The general approach is:

  • If time is before start time, then null (leave empty)
  • If time is after end time, then null
  • Else true

That may need to be adjusted slightly based on individual use case.

You would normally use date/time picker components to capture start/end date/time, and write those to user specific columns. Then use single value columns to apply those values to all rows in your data table, and then apply the above if-then-else logic.

2 Likes

Oh i mean there is an option available in the If Condition but I have no idea how to use it.

Can it be within 2 predefined times or can it only use the value “today”?

If you want predefined dates and/or times other than today/now, then you’ll have to define those separately using math columns.

For example, let say you want a start date of 24 hours ago, then you could create a math column using Now -1, and then reference that column in your if-then-else column.

Ok. So it has to be within a 24 hour window and not 2 predefined times like 2 dates?

It can be anything you like.

Can you give me a specific example of what you need?

So i have a column with a timestamp in each row. And I want to create a If condition column to say IF “time_column” is within “9:30AM to 12:00PM” then “Earlybird”.

Okay, cool.

For this, you can use a math column with the formula Hour(Date)
This will give you a number representing the hour of the day from the date/time.

Then you can do something like:

  • If Hour is less than 9.5, then null
  • If Hour is greater than 12, then null
  • Else “Earlybird”
3 Likes

Thank you for that!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.