Jump to content

time()


westman
 Share

Recommended Posts

hi all,i got 1 for you ;) i am placing this in my DB...$time = time() - 259200;witch is (now - 3 days) and i am using VAR (50) in my DB how can i pull this out on my DB to show on the page... "2days,7hours,34min left" i looked at...http://www.w3schools.com/php/func_date_time.aspbut it only shows days and i need time any help?

Link to comment
Share on other sites

got it!!!... i 1st tryed...

function time_elapsed_A($secs){    $bit = array(	    'y' => $secs / 31556926 % 12,	    'w' => $secs / 604800 % 52,	    'd' => $secs / 86400 % 7,	    'h' => $secs / 3600 % 24,	    'm' => $secs / 60 % 60,	    //'s' => $secs % 60	    );	      foreach($bit as $k => $v)	    if($v > 0)$ret[] = $v . $k;	      return join(' ', $ret);    }$nowtime = time();$dis_time_left = time_elapsed_A($dis_d_time_indb - $nowtime)."\n";

and i found a bug in this so i made...

$nowtime = time();$secs = ($dis_d_time_indb - $nowtime);$day_left = $secs / 86400 % 7;$hour_left = $secs / 3600 % 24;$min_left = $secs / 60 % 60;$dis_time_left = '' . $day_left .' D ' . $hour_left . ' H ' . $min_left . ' M '';

and this works for me 100% of the time ;) thank you and please comment

Link to comment
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
 Share

×
×
  • Create New...