Alteryx Designer Desktop Discussions

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

Military Time and Time Difference questions

czello
8 - Asteroid

I'd seeking some additional understanding while approaching Weekly Challenge #68: Elapsed Classroom Times.  I'm trying to break this down, before I look at any solutions.

 

I'm wondering how I decide which order to place which tools, because there are several things happening?

 

I'm wondering if convert the String to a Time format first, using RegEx?  Or is it better to use something like the Formula Tool?  Create a new column named Start Time which contain the Function IF [MILITARY BEGIN_TIME]>=1300 THEN [MILITARY BEGIN_TIME]-1200 ELSE [MILITARY BEGIN_TIME] ENDIF

 

Aside from that formula, I'd have two more functions for End Time and Elapsed Time.

MilitaryTimeFxPic1.PNG

 

I think that Elapsed Time would use the DateTimeDiff function.  Where I'm struggling is with converting the data into the correct 12hr format and doing the Elapsed Time (the difference).

 

And I'm also trying to figure out how to deal with any time before 10 a.m.,  Does a 0 need to be in the first character?  Formula using PadLeft?  Is this the best approach, or is there a Tool that solves this for Elapsed Time?

 

I'm not necessarily looking for the answer outright, but rather some ideas to help me arrive at a solution.  There is a lot going on with this Challenge!

 

Thank you.

1 REPLY 1
ScottLewis
10 - Fireball

Suggestions.

 

1. Try computing the elapsed time before converting. If you take a military time input and use toNumber then you can just parse total minutes using mod 60 or by splitting the time into hours/minutes. Avoids using a datetimeformula and doing that conversion.

2. If you keep the numbers as string the Padleft works fine. I would use that rather than a tool becuase you can just embed it in the formulas rather than treating it as a separate step.

Labels