Forums / General / how to convert date in timestamp

"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 convert date in timestamp

Author Message

Coulibaly Ibrahim

Monday 03 July 2006 2:10:53 am

Hello all

i have a problem with date conversion,

i have a date set as string, for exemple, today is: "03-07-06" (for french language)
i want to convert this date in timestamp linux in order to compare dates;
How can i do that?

i've defined the PHPOperator (strtotime()) in my template.ini
but the result of this code changes every time :(

{"03-07-2006"|strtotime()} {* or strtotime("03-07-2006")*}

do someone knows why?
please help.
how can i compare date.
PS: an attribute of my class is defined as texfield, that's filled by users as "03-07-2006"

Paul Borgermans

Monday 03 July 2006 4:45:08 am

strtotime depends on your locale settings (I think at OS level)

But you may consider using the ez template operator makedate for this:

http://ez.no/doc/ez_publish/technical_manual/3_7/reference/template_operators/miscellaneous/makedate

hth

--paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans