How to I add or subtract minutes from a time field?
In this case, I need to add 30 minutes to each of my "Start Times" to get the "End Times".
DateTimeAdd([Start Time],+30,"minutes") gives conversion error: DATETIMEADD: "04:00:00" is not a valid DateTime.
I can think of a couple workarounds but is there an easy way to do this?
Sample workflow:
Solved! Go to Solution.
datetimeadd([my date],30,"minutes")
I changed EndTime from String to Time in the select tool, and the workflow ran just fine.
@MarqueeCrew and @adm510 ... Thanks for the fast response!
I made those two changes but I'm still not getting it.
How strange... I am still getting the same error, even with the sample workflow you sent back.
Bizarre, I'm using v11.0 so there could potentially be some differences there. From your screenshot, it doesn't seem like the addition is the problem, Alteryx is having a problem reading your start time as a time and this is why the datetimeadd fails. You may need to add the select tool back and explicitly cast start time as time... but it's still strange that it works without issue for me.
This conversion error is occurring because the DateTimeAdd() function is expecting a DateTime value instead of just the Time value being supplied. You can easily correct this in the sample workflow with the follow formula adjustment.
DateTimeAdd("1970-01-01 "+[Start Time],30,"minutes")
Deborah,
Please try this formula:
DateTimeAdd("2017-01-01 " +[Start Time],30,"minutes")
your time needs a date too.
Cheers,
Mark
Problem Solved! Thanks, Mark!