Page 1 of 1

datetime::createFromFormat

Posted: Tue May 17, 2011 4:56 pm
by RussellEngland
If I use

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));
}
Then I get an error saying missing data.

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 
$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.

Re: datetime::createFromFormat

Posted: Wed May 18, 2011 8:53 am
by Jade