MySQLi Error "Incorrect datetime value"

Just out of curiosity, is anyone else encountering this error when creating or updating a collection in the admin interface? I had to patch a few files to get around the issue, but I'm wondering if this might be a global date/time config issue PHP config issue or a Windows issue.

Windows 7
localhost instance
PHP 5.2.14
Apache/2.2.16
MySQL 5.1.51-community

I too am having this issue. This is the full error I get:

Mysqli statement execute error : Incorrect datetime value: '2011-01-26T09:50:44+00:00' for column 'added' at row 1

I would be interested in what you did to correct this problem.

Cheers
Stephen

In fact, since version 1.3 I've been unable to add items too with a similar error message:

Mysqli statement execute error : Incorrect datetime value: 'NOW()' for column 'time' at row 1

My server specs are as follows:

Ubuntu 10.04 LTS
Apache 2.2.14
MySQL 5.1.41
PHP 5.3.2
Omeka 1.3.1

Would really appreciate any help.

I've just been reading through the MySQL documentation regarding the timestamp field and I cannot currently find any documentation which allows a timestamp field to be set as follows:

YYYY-MM-DDTHH:MM:SS+HH:MM
2011-01-26T09:50:44+00:00

So as far as I can make out, this is invalid and is probably only working in non strict mode.

The timestamp field can only store dates in UTC and does not store Timezone information. Therefore, insert statements should be rewritten with the correct timestamp format:

YYYY-MM-DD HH:MM:SS
2011-01-26 09:50:44

Could I therefore suggest that this is a bug with Omeka to be fixed.

Many Thanks
Stephen

More...

I eventually found the function which sets the dates for inserting into the omeka_collections table which is as follows:
/application/models/Collection.php

protected function beforeInsert()
{
    $this->added = Zend_Date::now()->toString(Zend_Date::ISO_8601);
    $this->modified = Zend_Date::now()->toString(Zend_Date::ISO_8601);
    if (!$this->owner_id && ($user = Omeka_Context::getInstance()->getCurrentUser())) {
        $this->setAddedBy($user);
    }
}

and I have changed this to:

protected function beforeInsert()
{
    $this->added = Zend_Date::now()->toString('YYYY-MM-DD HH:mm:ss');
    $this->modified = Zend_Date::now()->toString('YYYY-MM-DD HH:mm:ss');
    if (!$this->owner_id && ($user = Omeka_Context::getInstance()->getCurrentUser())) {
        $this->setAddedBy($user);
    }
}

Instead of using ISO 8601, I have specified a date format which is compatible with the MySQL Timestamp datatype and thus works when MySQL is in strict mode.

Thanks for pointing this out.

In the trunk, all the models, including Collection now format dates using the same, MySQL-compatible, formatting string.

Thanks for the response. Glad to hear this is resolved the the trunk version and I look forward to upgrading to the next version.

Cheers
Stephen