datetime::createFromFormat
Posted: Tue May 17, 2011 4:56 pm
If I use
Then I get an error saying missing data.
$localtime is an argument, I won't know if its a date, time or date+time.
Is there a way around this so that the time will default to 00:00:00?
Many thanks.
Code: Select all
echo showlocaltime('31/12/2011');
showlocaltime($localtime)
{
$localformat='d/m/Y H:i:s';
$servertime = new DateTime(null);
$servertime->createFromFormat($localformat, $localtime);
echo var_dump(DateTime::getLastErrors());
// return($servertime->format(DATE_ISO8601));
}
Code: Select all
array(4) { ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(1) ["errors"]=> array(1) { [10]=> string(12) "Data missing" } } from locale to server
Is there a way around this so that the time will default to 00:00:00?
Many thanks.