View Single Post
Old 04-24-2009, 11:54 AM   #6 (permalink)
sketchMedia
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

try to do it manually, see if it produces the same result, if not there may be somethings b0rked with abs, don't quite know what mind you, but just limit the possible avenues of error.

PHP Code:
function negToPos ($i)
{
    return 
$i ? -$i $i;
}
$startDate "20 September 2000";
$endDate "10 September 2000";
$test negToPos(ceil((strtotime($endDate) - strtotime($startDate)) / 86400));
echo 
$test
gives me, int 10 (as does the original abs() implementation)
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)

Last edited by sketchMedia : 04-24-2009 at 01:15 PM. Reason: typo in function name, not that it matters! but hey.
sketchMedia is offline  
Reply With Quote