PHP - why is this date function not erroring out
        Posted  
        
            by Phill Pafford
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Phill Pafford
        
        
        
        Published on 2010-04-20T19:10:38Z
        Indexed on 
            2010/04/20
            19:13 UTC
        
        
        Read the original article
        Hit count: 266
        
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?
© Stack Overflow or respective owner