thrownewInvalidParamException("Failed to parse '$value' as a UNIX timestamp.");
thrownewInvalidParamException("Failed to parse '$value' as a UNIX timestamp.");
}
}
return$timestamp;
return$timestamp;
}elseif(($timestamp=DateTime::createFromFormat('Y-m-d',$value))!==false){// try Y-m-d format
}elseif(($timestamp=DateTime::createFromFormat('Y-m-d',$value,newDateTimeZone('UTC')))!==false){// try Y-m-d format (support invalid dates like 2012-13-01)
return$timestamp;
return$timestamp;
}elseif(($timestamp=DateTime::createFromFormat('Y-m-d H:i:s',$value))!==false){// try Y-m-d H:i:s format
}elseif(($timestamp=DateTime::createFromFormat('Y-m-d H:i:s',$value,newDateTimeZone('UTC')))!==false){// try Y-m-d H:i:s format (support invalid dates like 2012-13-01 12:63:12)
return$timestamp;
return$timestamp;
}
}
// finally try to create a DateTime object with the value
// finally try to create a DateTime object with the value