We've recently made an accessibility improvement to the community and therefore posts without any content are no longer allowed. Please use the spoiler feature or add a short message in the message body in order to submit your weekly challenge.
alteryx Community

# Weekly Challenge

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
###### IDEAS WANTED

We're actively looking for ideas on how to improve Weekly Challenges and would love to hear what you think!

Submit Feedback

## Challenge #312: Hours, Minutes and Seconds

6 - Meteoroid
Spoiler

ACE Emeritus

Solved two ways! The long way, and the "one tool solution" way. 😁

Spoiler
The long way uses some of the traditional parsing tools to split the time into 3 parts, filter out 0 time, and apply the Hours/Minutes/Seconds labels before concatenating back together.

The "one tool solution" way, on the other hand, uses some nested formulas to strip out the time components (as long as they are not 0), string them together, and then remove any extra/unnecessary spaces.

Here's the one-tool formula I ended up using!

TrimLeft(
Replace(
If IsEmpty(TrimLeft(left([Chat Time],2),"0")) Then Null() Else TrimLeft(left([Chat Time],2),"0") + " Hours" Endif

+ " "
+ If IsEmpty(TrimLeft(Substring([Chat Time],3,2),"0")) Then Null() Else TrimLeft(Substring([Chat Time],3,2),"0") + " Minutes" Endif

+ " "
+ If IsEmpty(TrimLeft(Right([Chat Time],2),"0")) Then Null() Else TrimLeft(Right([Chat Time],2),"0") + " Seconds" Endif
," "," ")
)

Cheers!

NJ

8 - Asteroid

No need for that 2nd input of lookup values :)

Spoiler
7 - Meteor

Took a shot! Probably a better way to do it, but I

Spoiler
converted string to number and back to string to get rid of leading zeros

Spoiler

8 - Asteroid

10 - Fireball

First time back in Alteryx for a while, so starting off slow :)

10 - Fireball

one formula tool,

datetimeformat

regex_Replace to remove 00 and leading 0.

Spoiler

16 - Nebula
Spoiler
8 - Asteroid
Spoiler

Had to give it a go also with Regex, capture groups to the rescue

8 - Asteroid
Spoiler