Anders Lars
02/03/2023, 5:53 PM<cfscript>
jTime = createObject( "java", "java.time.LocalTime" )
jEnum = createObject("java", "java.time.temporal.ChronoUnit");
variables.time1 = jTime.now();
variables.time2 = jTime.parse('17:28:51');
echo(variables.time1.until(variables.time2, jEnum.seconds));
</cfscript>
Method gets called pretty often, otw I would not be sweating it.
thanks!Marc Funaro
02/03/2023, 6:07 PMdatepart in the native DateDiff function won't work for you?
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-c-d/DateDiff.htmlcfvonner
02/03/2023, 6:19 PMDateDiff requires two dates. So, as he stated, he'd have to turn the time string into a date object (using the current date's month/day/year in order to use DateDiff , rather than being able to just work with times alone.Anders Lars
02/03/2023, 6:25 PM<cfscript>
dNow = now();
inputTime = '03:02:22';
inputTimeArray = listToArray(inputTime, ':');
newDate = createDateTime(dNow.year(), dNow.month(), dNow.day(), inputTimeArray[1], inputTimeArray[2], inputTimeArray[3]);
echo(newDate);
</cfscript>Marc Funaro
02/03/2023, 6:26 PMsalted
02/08/2023, 4:53 PMsalted
02/08/2023, 4:53 PMInt()salted
02/08/2023, 4:53 PMsalted
02/08/2023, 4:56 PMJonas Eriksson
03/01/2023, 10:53 AMsalted
03/01/2023, 10:54 AMquarter(date)salted
03/01/2023, 10:54 AMJonas Eriksson
03/01/2023, 11:17 AMsalted
03/01/2023, 12:20 PM