Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
It's the most wonderful time of the year - Santalytics 2020 is here! This year, Santa's workshop needs the help of the Alteryx Community to help get back on track, so head over to the Group Hub for all the info to get started!
SOLVED

Convert ISO 8601 duration to youtube format MM:SS

Highlighted
7 - Meteor

So I have ISO 8601 formats for youtube video. For example I have PT10M1S, need to convert this to MM:SS. I found a few possible solutions for this. But nothing seems to be working. Thank You ahead of time

Highlighted
Alteryx Partner

I can't find any info on the M and S, although I assume this is minutes and seconds.  Is the PT related to Pacific Time and if so is there a date ?

 

Can you provide some dummy data that has M as a single digit and a double digit - just to be sure the solution is correct ?

Highlighted
Alteryx Partner

LOTS of expressions in here so you can see what I've done.  It's possible to consolidate it if you need to.

Highlighted
16 - Nebula
16 - Nebula

I suggest:

 

2019-01-12_11-29-29.jpg

 

First use Regex to parse the expression:

^P(\d+Y)?(\d+M)?(\d+D)?(T(\d+H)?(\d+M)?(\d+S)?)?$

You can then use a multifield formula to convert to integer columns of Year, Month, Day, Hour. Minute. Second

 

Finally to put back to YouTube you can just another formula tool.

Highlighted
7 - Meteor

Works perfectly! Thank You

Labels