How do i get the date for (eg) a week ago

Author Message

Nick Woods

Friday 05 March 2004 5:07:46 am

currentdate() returns the current date and time. How can i modify the results, so that e.g I can get the date for a week ago or a month ago.

I want to use the result to compare with date values held in my classes so the results have to be compatible.

I've tried adding and subtracting data and piping it through datetime but it doesnt work. i.e

{currentdate()|datetime(custom,"%Y/%m/%d")} works

but

{currentdate() + <i>any number</i>|datetime(custom,"%Y/%m/%d")} doesnt

liu spider

Friday 05 March 2004 9:08:19 am

try this:
{sub(currentdate(),3600)|datetime(custom,"%Y/%m/%d")}

this will get the time one hour ago

TIPS: remember no +/- in eZ template, only add and sub etc

http://liucougar.scim-im.org
SCIM Input Method Platform
http://scim.sf.net
SJSD Online Editor
http://sf.net/projects/sjsd

Nick Woods

Friday 05 March 2004 9:25:32 am

Thanks ! wasnt aware that I shouldnt use + and -

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 18 2025 19:30:58
Script start
Timing: Jan 18 2025 19:30:58
Module start 'layout'
Timing: Jan 18 2025 19:30:58
Module start 'content'
Timing: Jan 18 2025 19:30:59
Module end 'content'
Timing: Jan 18 2025 19:30:59
Script end

Main resources:

Total runtime0.7585 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0077 589.1484152.6406
Module start 'layout' 0.00780.0040 741.789139.4766
Module start 'content' 0.01180.7451 781.2656527.3438
Module end 'content' 0.75680.0017 1,308.60948.1250
Script end 0.7585  1,316.7344 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.4058160.0002
Check MTime0.00120.1646160.0001
Mysql Total
Database connection0.00220.295010.0022
Mysqli_queries0.711893.8431570.0125
Looping result0.00050.0719550.0000
Template Total0.725995.720.3629
Template load0.00200.262520.0010
Template processing0.723995.429420.3619
Template load and register function0.00020.026010.0002
states
state_id_array0.00090.113710.0009
state_identifier_array0.00060.085720.0003
Override
Cache load0.00160.2091170.0001
Sytem overhead
Fetch class attribute can translate value0.00070.093920.0004
Fetch class attribute name0.00130.174840.0003
XML
Image XML parsing0.00080.101620.0004
class_abstraction
Instantiating content class attribute0.00000.001240.0000
General
dbfile0.00110.1442160.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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 10
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs