Youtube time-duration

Hi
Im getting a YouTube timeduraion for my videos in PT1H32S

How do i convert that to normal minutes and seconds… ??

I’ve tried with the following :

{{formatDate(parseNumber(replace(replace(21.$1; “PT”; ); “S”; )); “00:00”)}}

1 Like

Hi @Thomas_Koch_Nielsen,

If you trying to parse “PT< hr >H< min >M< sec >S”

You can use this Regex Pattern,

PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?

in a Text Parser Match Pattern like below:

It will result you $1,$2,$3 as hours, minutes, seconds respectively.

Best regards,
Msquare Automation
Platinum Partner of Make
@Msquare_Automation

3 Likes

Welcome to the Make community!

You can use a Text Parser “Match Pattern” module with this Pattern (regular expression):

^PT(?:(?<hour>\d+)H)?(?:(?<min>\d+)M)?(?:(?<sec>\d+)S)?$

Proof https://regex101.com/r/PG9DNp/1

Important Info

  • :warning: Global match must be set to NO!

Screenshot

Screenshot_2025-04-26_230431


For more information, see the Text Parser page in the Make Help Center:

Match Pattern
The Match pattern module enables you to find and extract string elements matching a search pattern from a given text. The search pattern is a regular expression, which is a sequence of characters in which each character is either a metacharacter, having a special meaning, or a regular character that has a literal meaning.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.