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
$midnight= date("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.