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.