Please educate me

In ST (SmartThings) I could enter in times (t1, t2) and that would work in
timeOfDayIsBetween command as shown in def ST below. However, in Hubitat, I have to add "toDateTime" (see def HE below) to get the timeOfDayIsBetween
command to work. Can someone explain this to me or am I setting up my t1 and t2 inputs incorrectly?
BTW, I added the error msg I get from HE if I don't use "toDateTime".

def main(){
dynamicPage(name: "main", title: "Send Hub Events", uninstall: true, install: true){
section("Define Monitoring Time") {
input "t1", "time", title: "From", required: true
input "t1", "time", title: "To", required: true
}
}
}

....stuff......

def ST(evt){
def run_time = timeOfDayIsBetween(t1, t2, new Date(), location.timeZone)
}

def HE(evt){
def run_time = timeOfDayIsBetween(toDateTime(t1), toDateTime(t2), new Date(), location.timeZone)
}

The error is on the def run_time line in HE if I don't use "toDateTime(t1)" and "toDateTime(t2)"

errorgroovy.lang.MissingMethodException: No signature of method: user_app_wrj54_Test3_225.timeOfDayIsBetween() is applicable for argument types:
(java.lang.String, java.lang.String, java.util.Date, sun.util.calendar.ZoneInfo)
values: [2019-05-22T09:00:00.000-0500, 2019-05-22T11:30:00.000-0500, ...] on line 165 (BillsSwitchHandler)

Smartthings was really good about not fully documenting their methods. In this case, timeOfDayIsBetween only accepts Date objects for the first 2 parameters:
https://docs.smartthings.com/en/latest/ref-docs/smartapp-ref.html?highlight=timeofdayisbetween#timeofdayisbetween

But obviously they also allow Strings. Can you tell me what the format is of the string you are passing to the method and I can create an issue to get that additional method signature added to our platform.

BTW, our method is documented here:
https://docs.hubitat.com/index.php?title=Common_Methods_Object#timeOfDayIsBetween

1 Like

Chuck, thank you
The input statement (input "t1", "time", title: "From", required: true) generates a format of: 2019-05-22T13:30:00.000-0500 in HE. I shutdown ST since I "jumped ship" so I'm not sure of their format.