Hi,
I am new to Alteryx trying to subtract 2 time columns and convert that to hours, minutes and seconds.
I have the syntax and it works perfect for some rows, but the hours is not working for some special cells, Can you please check my hours and find the problem
I have converted both Final and First time to time format before.
Diff Seconds: DateTimeDiff([Final Time],[First Time] ,'Second')
Then for seconds: Mod([Diff Seconds], 60)
For Minutes: Mod([Diff Seconds]/60, 60)
For Hours: ([Diff Seconds]/3600)
And finally : ToString([Hours])+":"+PadLeft([Mins],2,"0")+":"+PadLeft([Seconds],2,"0")
Can you please tell what is wrong with my syntax?
Solved! Go to Solution.
Hi @Nargess ,
Can you provide some sample data on a excel/csv file.
That can help us to provide you a solution.
Hi Nargess,
Think it's all broadly correct.
You just need to make sure your hours minutes and seconds are strings before padding them with zeros.
You might also need to round the hours down to get the correct answer.
Also, Final Time and First Time must be datetime datatypes.
See attached to see a working version...
Thank you Philip,
I will check and Let you know.