Add "from Variable" to appropriate "time operations"

hi, i bumped into some issues with the Date Time manipulations

  1. there's no easy way to take dt_Date and dt_Time and merge them into one dt_DateTime. Time operations like "Set ONLY Time" and "Set ONLY Date" do not have an option to read from another Variable.
  2. I tried doing it through strings: %dt_Date%T%dt_Time% and assigning it to a datetime variable but then there's a problem with the timezone, which fires "unexpected error" loop with the restore from backup as the only resort. there's no way to edit or delete the rule. I guess try/catch would help for any type of failing rule on a java command.
  3. adding the timezone to %dt_Date%T%dt_Time% is a problem, because Format DateTime doesn't have a way to extract just the Timezone.

please advise

Thank you

The Date & Time Parser driver, available in this forum, allows you to create a virtual device that extracts all kinds of time values, including the GMT offset.

1 Like

Also, what is your ultimate end-goal with these operations?

Here's an example of what the Date & Time Parser driver can do when assigned to a virtual device:

I use it to set a hub variable that I use in numerous Rules:
image

Here's an example where I construct a time-only string with correct GMT offset (vTokenString is a variable with a value like "23:30"):

1 Like

Thank you for the recommendation. It looks like it's the only way to do what I need.

Still, it seams like it would be easier to add ability to apply datetime functions from another variable (where possible) than adding drivers and creating devices.

i have a datetime1 variable datetime which i receive from a driver on daily basis and there's a datetime2 (datetime) variable containing ONLY time, which is set once in a while.

I need a 3rd variable which will have the date from the datetime1 and the earliest time between datetim1 and datetime2 .

1 Like