The (first) error lies here
dcjones;10988720 wrote:
strlen($dayVar < 2)
Hint: you want to compare the string length to something, rather than take the string length of a comparison.
But perhaps this is easier
# If I understand you correctly, your date is in the format d/mm/yyyy
$FlightDateTemp = "4/10/2011";
$parts = explode('/', $FlightDateTemp);
$time = mktime(0, 0, 0, $parts[1], $parts[0], $parts[2]);
# This uses 4 digit year, 2 digit month, 2 digit day
$newFormat = date('Y-m-d', $time);
echo $newFormat;
And if your initial date is actually on the form m/dd/yyyy, it's even easier
# m/dd/yyy
$FlightDateTemp = "4/10/2011";
$time = strtotime($FlightDateTemp);
$newFormat = date('Y-m-d', $time);
echo $newFormat;