How to assign value to attribute of type date?

Author Message

Ilya Sazonov

Saturday 06 November 2010 5:58:48 am

I have a class, which has an attribute of type date. And now I'm trying to import objects of that class to my site. With PHP. Everything is ok, but date is always 01/01/1970.

To specify date I do the following.

$attributesData['publication_date'] = '01/11/2010';

Maybe that's not the right way to specify date? Which is the right way then?

Heath

Saturday 06 November 2010 6:27:43 am

Hello Ilya,

Try converting your date to a timestamp before storing. Dates are stored as timestamps.

http://ezpedia.org/ez/simple_fromstring_and_tostring_interface_for_attributes

Cheers,

Heath

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Ilya Sazonov

Saturday 06 November 2010 6:39:01 am

Wow! It really helped! Thank's a lot!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.