Missed the Q4 Fall Release Product Update? Watch the on-demand webinar for more info on the latest in Designer 24.2, Auto Insights Magic Reports, and more!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
RESUELTAS

Adding 2 Times

Maltaleb001
Meteoroide

Hi all,

 

I have this data and I want to add the (duration in Mins) to the time on the first column.

Maltaleb001_0-1637233544088.png

 

I tried many ways but couldn't do it. One of them is using the following function but it's not working:

Maltaleb001_1-1637233592868.png

 

 

Any advice on what's the best way, hopefully easy one?

3 RESPUESTAS 3
afv2688
16 - Nebula
16 - Nebula

Hello @Maltaleb001 ,

 

Thats an interesting question. Would like to know if there is a better way than this one:

 

 

DateTimeAdd([Field1],DateTimeSeconds([Field2])+60*DateTimeMinutes([Field2])+DateTimeHour([Field2])*3600, 'seconds')

 

 

Untitled.png

 

Here I am transforming the time into seconds

 

Hope it helps

 

Regards

Christina_H
Magnetar

You need to convert the time to a number field with the total number of minutes or seconds to add on in order to use DateTimeAdd.  See a couple of solutions on this thread:

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Adding-Times-Together/td-p/8658

Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @Maltaleb001,

 

I decided to use three separate formulas to add on the hours, minutes and seconds

 

 

DateTimeAdd([DateTime],DateTimeHour(ToDateTime('1900-01-01 '  + ToString([Duration in Mins]))),'hour')

 

 

 

DateTimeAdd([DateTime],DateTimeMinutes(ToDateTime('1900-01-01 '  + ToString([Duration in Mins]))),'minute')

 

 

 

DateTimeAdd([DateTime],DateTimeSeconds(ToDateTime('1900-01-01 '  + ToString([Duration in Mins]))),'seconds')

 

 

JonathanSherman_0-1637235590128.png

 

 

I've attached my workflow for you to download if needed!

 

Kind regards,

Jonathan

 

Etiquetas
Autores con mayor cantidad de soluciones