function convertDT($TS) {
$TS = strtotime($TS);
$TS -= date("Z");
$newTS = date("Y-m-d\TH:i:s\Z", $TS);
return $newTS;
}
echo "Good: ".convertDT('2010-04-20 01:23:45')."\n";
echo "Bad: ".convertDT('2010-31-20 01:23:45')."\n";
The second date returns: 1969-12-31T23:00:00Z
Why? Should this error?