Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * @author Genesis730
  5.  * @copyright 2011
  6.  */
  7.  
  8. date_default_timezone_set('MST');
  9.  
  10. $hms = date('H:i:'."00"); /// MST is Arizona time please adjust to either server timezone or your timezone
  11.  
  12. define("FUEL", "320");
  13.  
  14. list($hrs,$mins,$secs) = explode(':',$hms);
  15. $minutes = $mins / 60;
  16. $minutes2 = sprintf("%d", $minutes*100);
  17. $formatted = $hrs .".". $minutes2;
  18.  
  19. $cost = $minutes*FUEL;
  20. $cost = sprintf("%0.02f", $cost);
  21. $cost = "£".$cost;
  22.  
  23.  
  24. echo "Fuel Cost: £".FUEL." / hour<br />"
  25. ."Current time: ".$hms." (seconds rounded down to 00)<br />"
  26. ."Minutes past the hour: ".$mins."<br />"
  27. ."Minutes as a decimal: ".$minutes."<br />"
  28. ."Fuel cost since ".$hrs.":00 ".date('A')
  29. ." - ".$cost;
  30.  
  31. echo "<br /><br />".$min;
  32. echo "<br />formatted time: ".$formatted;
  33.  
  34.  
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement