function StatisticsProBaseTestCase::getAddedDate in Statistics Pro 6.2
Same name and namespace in other branches
- 6 tests/statspro.test \StatisticsProBaseTestCase::getAddedDate()
1 call to StatisticsProBaseTestCase::getAddedDate()
File
- tests/
statspro.test, line 53 - Functionality tests for Statistics Pro.
Class
- StatisticsProBaseTestCase
- Base class for Statistics Pro tests.
Code
function getAddedDate($timestamp, $diff = 0, $diff_unit = 'd') {
switch ($diff_unit) {
case 's':
$delta = $diff;
break;
case 'm':
$delta = 60 * $diff;
break;
case 'h':
$delta = 3600 * $diff;
break;
case 'w':
$delta = 7 * 24 * 3600 * $diff;
break;
case 'y':
$delta = 365 * 24 * 3600 * $diff;
break;
default:
$delta = 24 * 3600 * $diff;
}
$timestamp += $delta;
return $timestamp;
}