I have a duration string "PT1M33S". I would like to get result in the following format -> 01:33 Can anyone please tell me how to do so using js or jquery??
This seems be not a timeformat, just duration of the video.
------ 33 Seconds
''
PT1M33S
'------- 1 Minute
H - Hours
M - Minutes
S- Seconds
So try this
var timeD = "PT1M33S";
var formattedTime = timeD.replace("PT","").replace("H",":").replace("M",":").replace("S","")
alert(formattedTime);
Fiddle for example, can be a done with a simple regex too.
Hope you understand.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With