Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

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

Add time to the date

joannasokolowska
9 - Comet

Hi all,

I need your advice regarding adding time to the given date. In my data set I have start date and length in hours, therefore based on those information I need calculate end date. I attached Alteryx workflow with Data example. 

 

Thanks in advance!

Asia

4 REPLIES 4
dougperez
12 - Quasar

I converted the datetime collumn to datetime and just did a datetimeadd, but I have one question, your lenght is in hours? I didnt understand some of those (3.67 is 3 hours and 67 minutes?)

atcodedog05
22 - Nova
22 - Nova

Hi @joannasokolowska 

 

Since you have length with decimal i ended up creating 2 variations

 

Variation 1: i added length as hours directly. Observation on this was decimal were converted to whole numbers (ex 4.75hr converted to 4hr) refer the below output.

Variation 2: i added length by converting decimal hrs to mins (length * 60). Observation here was it was accommodating the decimal hours

 

atcodedog05_1-1621071991982.png

 

Hope this helps 🙂

joannasokolowska
9 - Comet

Hi,

The second option did the work 🙂 Thank you so much for a quick help! 

 

Asia

joannasokolowska
9 - Comet

Thank you for the suggestion! The length was in hours so to be able to convert it into minutes it was needed to multiply it by 60. 

 

This is the example of the formula that did the job :

 

DateTimeAdd(
DateTimeParse([Start date],"%d/%m/%y %H:%M")
,[length]*60,"minutes")

 

Thank!

Asia

Labels