How to add days to a time variable?

I'm fairly new to HE and RM and am trying to set up a future date rule trigger. For example, I thought that I could just use the following 5.1 RM actions to define a trigger one week in the future:

Set WeekTrigger to current date(2023-06-11)
Set WeekTrigger to WeekTrigger(2023-06-11) plus 10080 minutes

But the minutes offset doesn't work -- WeekTrigger's value remains (2023-06-11). I'm surprised that the minutes offset can't use (seems like a bug to me). In any case, I've been racking my brain trying to come up with an alternative...any ideas out there?

I don't see a way to trigger on a date without a time. Your actions will work if you use "current date and time" instead.

1 Like

Thanks! But I still had a difficult time finding a way to do what I need. I want to be able to input a DateOnly value by way of a dashboard Variable tile. Then, I want to trigger a rule at a certain time a certain # of days before that date. I can create a DateOnly dashboard tile (see below). But I can't then shift it by the needed days. The dashboard tile's variable must be DateTime in order for it to be shifted/offset. That causes two problems: the dashboard tile shows and requires input of an irrelevant time value, AND the irrelevant time component later causes trigger and comparison headaches. There must be a way; so did a deep dive...

In systematically exploring this problem I found C-8 HE's (with RM 5.1) handling of date-only & date+time variables a bit of a mess. To wit, it took me lots of experimentation to discern:

  • Creating a new DateTime Hub Variable requires both an initial date AND time value.
  • A DateTime variable can be changed to DateOnly variable by:
    • Manually clicking on its value in Hub Variables and clearing the time component (note: you can't clear date component).
    • A "Set Variable to Current Date" rule action.
    • A "Set Variable A to Variable B" rule action where var B is DateOnly.
  • A DateTime variable can be changed to a TimeOnly variable by:
    • A "Set Variable to Current Time" rule action.
    • A "Set Variable A to Variable B" rule action where the var B is TimeOnly.
  • Existing DateTime and TimeOnly values can be modified with a minutes Offset (e.g., "Set Variable to Variable plus" or "Set Variable Time Offset". Both negative & positive Offsets allowed. Applying an Offset to an existing DateOnly variable has no effect.
  • Variable assignment also assigns both type and value. That is, you can't assign just the DateOnly or TimeOnly components.of a DateTime variable. Therefore, you can't "retype" a DateOnly value into a DateTime for Offset modification.
  • Variable comparison between DateTime, DateOnly, & TimeOnly variables, although always allowed, can be a little weird --- an equality test between a DateOnly and a DateTime is NEVER true, even if date components agree; > & < comparisons between DateOnly & DateTime variables seem to work as expected. It appears that DateOnly values are treated as 12:00AM on that day.

Whew, so I can shift/Offset the current DateTime value and then compare that to the dashboard inputted DateOnly value. That way, only a date needs to be supplied via a dashboard and I can later compare it against a date shifted/offset value.

Did anyone figure out how to offset a date only hub variable without turning it into date-and-time variable?