Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Date time, to time in seconds

Genty
7 - Meteor

Hi,

 

I am trying to convert date time to just time in seconds with the below formula someone already helped me with.

 

/*Hours to seconds*/
(ToNumber(Left([Duty Time],2))*3600)
+
/*Minutes to seconds*/
(ToNumber(Substring([Duty Time],3,2))*60)
+
/*seconds*/
ToNumber(Substring([Duty Time],5,2))

 

I seem to be getting the same result regardless of duty time however? see attached screenshot.

 

Any help would be appreciated.

5 REPLIES 5
JoeS
Alteryx
Alteryx

Hi @Genty 

 

It's due to your Duty Time having the date on the front of it.

 

If it's just the time portion it will work.

 

Cheers

Joe

Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @Genty,

 

I would probably use the below formula which is a little simpler:

 

ToNumber(DateTimeFormat([Time],'%S')) +
ToNumber(DateTimeFormat([Time],'%M'))*60 +
ToNumber(DateTimeFormat([Time],'%H'))*3600

 

 

image.png

 

If this solves your issue please mark the answer as correct, if not let me know! I've attached my workflow for you to download if needed.

 

Regards,

Jonathan

Genty
7 - Meteor

Thanks Guys both work, realised my input tab changed the column format from time to datetime. sometimes the simple things catch you out.

JoeS
Alteryx
Alteryx

Yup, can be fun working with dynamic data types 🙂

Rohitpatil7
6 - Meteoroid

works for me, thank you.

Labels