Tero

[+] Convert Youtube time from API

May 14th, 2018
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.23 KB | None | 0 0
  1. function ctime($t) {
  2.     $s = new DateTime('@0');
  3.     $s->add(new DateInterval($t));
  4.     if (strlen($t)>8)
  5.         return $s->format('g:i:s');
  6.         else
  7.         return $s->format('i:s');
  8. }
  9.  
  10. echo ctime('PT3M44S'); // return: 03:44
Advertisement
Add Comment
Please, Sign In to add comment