Alteryx Designer Desktop Discussions

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

Convert ISO 8601 duration to youtube format MM:SS

rjanezic
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

4 REPLIES 4
cmcclellan
13 - Pulsar

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 ?

cmcclellan
13 - Pulsar

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

jdunkerley79
ACE Emeritus
ACE Emeritus

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.

rjanezic
7 - Meteor

Works perfectly! Thank You

Labels