View Single Post
Old 02-12-2003, 03:55 PM   #9 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,529
sde is on a distinguished road
here's 2 methods:

the first method we'll get the current hour, minutes, and seconds, then do some math to add them together:
PHP Code:
<?
$current_time
=time(); 

// set seconds 
$seconds date("s",$current_time); 

// set minutes 
$minutes date("i",$current_time); 

// set hours 
$hours date("H",$current_time); 

// calculate how many seconds in the minutes, and add to seconds 
$seconds $seconds + ($minutes 60); 

// calculate how many seconds in the hours, and add to seconds 
$seconds $seconds + ($hours 60) * 60

echo 
$seconds;
?>
second method we will get the time of today at midnight, .. then subtract that from the current timestamp:
PHP Code:
<?
// set the midnight date stamp for today
$midnightdate("Y-m-d") . " 0:0:0";

// set the current timestamp
$now=time();

// subtract now from midnight to get total seconds for today
$total_seconds_for_today=$now strtotime($midnight);

echo 
$total_seconds_for_today;
?>
both these examples will output the same thing.
sde is offline   Reply With Quote