Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Adding Time and seconds / Converting Seconds to Time

AlexL
7 - Meteor

Question –

How do I get Alteryx to add time & seconds?

 

Field one has a start time (Excel Format- H:MM:SS AM/PM)

Field two has a duration in seconds. (Excel format- SSS)

 

Excel Solution-

  1. Divide Duration (Sec)/86400
  2. Convert the format to time
  3. Add Start Time with Duration (Time)

 

Problem –

Is it possible to get this solution in Alteryx?

 

Sample –

 

Field 1

Field 2

End Result

Start Time

Duration (Sec)

End Time

9:00:00

300

9:05:00

9:05:00

60

9:06:00

 

 

 

6 REPLIES 6
Joe_Mako
12 - Quasar

Generally, we would think an expression like:

DateTimeAdd([Start Time],[Duration (Sec)],"seconds")

would be what you are looking for, but that will error out if [Start Time] is a Time data type.

 

We need to first to make it look like a DateTime data type, and then we can use the DateTimeAdd() function. Something like:

DateTimeAdd(DateTimeToday()+" "+[Start Time],[Duration (Sec)],"seconds")

works in the attached, and notice the data type of the output column is Time in the attached.

 

As long as a string is in the Alteryx DateTime format "%Y-%m-%d %H:%M:%S", Alteryx can use it as a DateTime data type.

AlexL
7 - Meteor

Exactly what I needed!

Thank you!

TPR
6 - Meteoroid

I need to evaluate a time between times... 

Basically look at: AND TO_DATE ('0001-01-01 ' || MBCM.ENTRY_TM,
'YYYY-MM-DD HH24.MI.SS') BETWEEN TO_DATE (
'0001-01-01 '
|| OGWP.CRTE_TM,
'YYYY-MM-DD HH24.MI.SS')
- INTERVAL '59' SECOND
AND TO_DATE (
'0001-01-01 '
|| OGWP.CRTE_TM,
'YYYY-MM-DD HH24.MI.SS')
+ INTERVAL '59' SECOND

 

This works in oracle in TOAD but not in alteryx.  How can evaluate if a time stamp in one table falls between another time in another table with a 59 second interval?

Anaz_S
6 - Meteoroid

I want to convert the seconds into 60 seconds into 1 minute i.e, 00:01:00
600 seconds into 10 minute i.e., 00:10:00

Thank you in advance

mwindeler
7 - Meteor

mwindeler_0-1581943052772.png

@Anaz_S I have done this before, may not be the most elegant way, but it will give you what you want. Just a string of commands within the Formula tool.

 

AlexL
7 - Meteor

Please see attached.  The final result can be in either string or time format.

Alteryx - Convert Seconds to Time.jpg

Labels
Top Solution Authors