Forums / Developer / How to assign value to attribute of type date?

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

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

7x | https://se7enx.com/
Brookins Consulting | https://brookinsconsulting.com/
Certified | http://web.archive.org/web/201012...th.ez.no/certification/verify/380350
Solutions | https://projects.exponential.earth/users/community/brookins-consulting
eZpedia community documentation project | http://ezpedia.se7enx.com

Ilya Sazonov

Saturday 06 November 2010 6:39:01 am

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