Forums / Setup & design / Show the date of tomorrow

Show the date of tomorrow

Author Message

Antonino Ioppolo

Wednesday 10 December 2003 1:52:51 am

Hi,
I need to show the date of tomorrow in my template.
Does anybody know how to do this?

laurent le cadet

Wednesday 10 December 2003 6:57:02 am

Hi,

If you need to display only the date, you can try this :

{currentdate()|l10n( datetime )}

(this is from the demo version).

laurent

Antonino Ioppolo

Monday 15 December 2003 8:58:27 am

Hi, sorry for the delay. I've been really busy.

Anyway, Laurent, you misunderstood my question.

Nevertheless, I found a solution for making it so I'm posting in case it's useful for other people

What I needed was to display the date of tomorrow, i.e. today is December 15, I need to write December 16.

Well it's kind of a dirty hack but it's the best I could find.

Firs of all edit eztemplateautoload.php, located in /kernel/common, and add the following function

function tomorrow()
{
$tomorrow = mktime (0,0,0,date("m") ,date("d")+1,date("Y"));
return ($tomorrow);
}

Then edit template.ini locate under /settings:
Locate the section
PHPOperatorList[]

and add the line

PHPOperatorList[tomorrow]=tomorrow

now you can call the function in your template using something like this

{tomorrow()|datetime(custom,"%l %j %F %Y")}

I hope this is useful for other people.
By the way, if you have a better way to do this thing, post it ;)

laurent le cadet

Monday 15 December 2003 9:42:41 am

Sorry !

today, tomorrow...only 24 hours ;-)

Sorry again

Laurent

Brendan Pike

Tuesday 08 March 2005 11:45:14 pm

Incase anyone else is referencing this thread looking for a way to produce a future timestamp then see this thread for a better way.

http://www.ez.no/community/forum/general/how_can_i_set_a_specific_date_to_get_timestamp_please_help

www.dbinformatics.com.au

We are always interested in hearing from experienced eZ PHP programmers and eZ template designers interested in contract work.