Jump to content
xisto Community
Sign in to follow this  
mendezgarcia

Convert Decimal Days a little PHP script

Recommended Posts

OMGZ this script rocks!250.16 days = 250 day(s), 3 hour(s) and 50 minute(s)Gawsh...you guys have to bear with me for another year almost @_@Great work on it, though! <3

Share this post


Link to post
Share on other sites

522 day(s), 22 hour(s) and 34 minute(s) looks like i will be here a little longer then you bis :P. can't wait to hit the 2 year mark.

Share this post


Link to post
Share on other sites

There is nothing better to explain than... the source:

<html> <head>  <title>Convert decimal days</title> </head> <body> <font face="arial" size="2"> <h3>Convert decimal days</h3> <p><?phpfunction convert_date($date) {   $return = floor($date) . ' days';   $hours = ($date - floor($date))*24;   if ($hours != 0) {      $return .= ', ' . floor($hours) . ' hours';      $minutes = round(($hours - floor($hours))*60);      if ($minutes != 0) {         $return .= ' and ' . $minutes . ' minutes';      }   }   return $return;}$input = $_GET['days'];if (!empty($input)) {   echo $input . ' days = ' . convert_date($input) . '<p>';   }?>  <form>   <input type="text" name="days">   <input type="submit" value="Convert">  </form>  </font> </body></html>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.