So In an EventHandler microflow I need to compare 2 values, both expresed in seconds. So, before compare them, I need to transform a value of Time, expresed in hours and minutes, “HH:mm” that can go from 00:01 to 24:00 (1 second and 86400 beign this last value, the total amount of seconds in 1 day) how can I easily transform this time in HH:mm to seconds? is it a function for this? Get the total amount of seconds contained in the time value
asked
Constanza Pérez-yarza Ayala
2 answers
0
Hi,
If I get your idea correctly, you can do like this:
Create a string variable $myDate that takes a random date. For instance ‘03/30/2023’
Create a datetime variable $date1 with expression: parseDateTime($myDate, ‘MM/dd/yyyy’)
Create another datetime variable $date2 with expression: parseDateTime($myDate + ‘ ‘ + $yourHHmm, ‘MM/dd/yyyy hh:mm’)
Create a decimal variable $seconds with expression: secondsBetween($date1, $date2)
$yourHHmm is the value you want to convert to seconds.
Create a date time object with the right time and then you can count between this value and the start of the day. So for instance
secondsBetween(dateTime($dateToCheck), dateTime([%BeginOfCurrentDayUTC%])).
You do have to make sure that both are on the same day. So either create a variable date time of the current day and add the hours and minutes and then do the count.