php number format
November 28, 2008
$var = 4938509.958
echo number_format($var, 2, ‘,’, ‘.’);
output = 4,938,509.96
one liner if statement
October 24, 2008
$variable = ($x == TRUE)? 'the variable is true' : 'the variable is NOT TRUE';
count days between two dates
August 11, 2008
//function that will count days
function countdays($date1, $date2){
$days = abs(strtotime($date1)-strtotime($date2)) / 86400;
return $days;
}
//lets assign values
$date1 = '2008-08-17';
$date2 = '2008-08-12';
echo countdays($date1, $date2); //executes our function
mysql date to javascript date
July 31, 2008
<?php
echo date('m/d/Y', strtotime('2008-07-31'));
?>
trying to use your dates in mysql in javascript? use this code in your php page.