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

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

eZ debug

Timing: Jan 19 2025 04:34:41
Script start
Timing: Jan 19 2025 04:34:41
Module start 'layout'
Timing: Jan 19 2025 04:34:41
Module start 'content'
Timing: Jan 19 2025 04:34:42
Module end 'content'
Timing: Jan 19 2025 04:34:42
Script end

Main resources:

Total runtime0.5633 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0046 589.1563152.6250
Module start 'layout' 0.00460.0021 741.781339.4453
Module start 'content' 0.00670.5551 781.2266526.3594
Module end 'content' 0.56180.0015 1,307.58598.1563
Script end 0.5633  1,315.7422 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.5509160.0002
Check MTime0.00140.2469160.0001
Mysql Total
Database connection0.00070.130910.0007
Mysqli_queries0.517191.7940540.0096
Looping result0.00050.0887520.0000
Template Total0.534994.920.2674
Template load0.00220.387520.0011
Template processing0.532794.556620.2663
Template load and register function0.00020.044010.0002
states
state_id_array0.00110.203310.0011
state_identifier_array0.00260.459920.0013
Override
Cache load0.00180.3239220.0001
Sytem overhead
Fetch class attribute can translate value0.00080.143320.0004
Fetch class attribute name0.00170.306830.0006
XML
Image XML parsing0.00090.160720.0005
class_abstraction
Instantiating content class attribute0.00000.001430.0000
General
dbfile0.00090.1651170.0001
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 14
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs