## Function: Convert Days Into Seconds w/ PHP

While making the stats program for the backend of paulOr.net that shows me daily unique & page views in a graph for the past ten days, I needed a really easy way of calculating the amount of seconds in each day so that I could then do quick database querys without much code to grab the total amounts of visiters per day. My solution was this very quick function which converts the amount of days into seconds.

Theres quite a bit more that goes on behind the scenes but this is by far the simpliest form of what goes on. Perhaps others will find it useful also :]

**Function: Convert Days To Seconds**

[php]

## DAYS INTO SECONDS

function days_to_seconds($days) {

if(is_numeric($days)) {

return 86400*$days;

} else {

return ‘string must be numeric’;

}

}

## PARSE

echo days_to_seconds(8); // NUMBER OF DAYS

## RESULT

// 691200

[/php]