I am trying to find end time with duration and start time using ColdFusion. What I have tried is :
<cfset st_time=timeFormat("05:00:00",'hh:mm:ss tt')>
<cfset s_d=listToArray(duration,":")>
<cfset hours=s_d[1]>
<cfset min=s_d[2]>
<cfset sec=s_d[3]>
<cfset new_time = TimeFormat(createTime(hours, min, sec))>
Expected Output
start_time="05:00:00 PM"
duration="02:30:00"
then end_time should be 07:30:00 PM
how to calculate end time like this?
CodePudding user response:
Step 1 - Covert your duration to seconds.
Step 2 - Use ColdFusion's DateAdd
function to calculate the end time.