Time Diff Function
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Labels:
- Date Time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @Nargess ,
Can you provide some sample data on a excel/csv file.
That can help us to provide you a solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you all,
I have tried all possible options I found here. Attached please find my Excel file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you Philip,
I will check and Let you know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
