Posted By

optimal on 01/24/09


Tagged

time human readable days convert hours minutes


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

umang_nine
Nix
vali29
dantreacy


Convert Minutes to Human Readable Days / Hours / Minutes


 / Published in: PHP
 

So. You have some minutes and want a "human readable" version? Sure thing baby!

  1. $minutes = 3000;
  2. //
  3. // Assuming that your minutes value is $minutes
  4. //
  5. $d = floor ($minutes / 1440);
  6. $h = floor (($minutes - $d * 1440) / 60);
  7. $m = $minutes - ($d * 1440) - ($h * 60);
  8. //
  9. // Then you can output it like so...
  10. //
  11. echo "{$minutes}min converts to {$d}d {$h}h {$m}m";

Report this snippet  

You need to login to post a comment.