[ic] Date time stamp
Stefan Hornburg
racke at linuxia.de
Mon Jan 5 14:07:22 EST 2004
On Mon, 05 Jan 2004 10:26:30 -0800
Anthony Minero <anthony at urbanscooters.com> wrote:
> On 12/30/03 6:12 PM, "Mike Heins" <mike at perusion.com> wrote:
>
> > Quoting Anthony Minero (anthony at urbanscooters.com):
> >> I read the developers resource notes on how to add the date to a page and it
> >> is pretty straight forward, I'm just using;
> >> [time]%A, %B %d, %Y[/time]
> >>
> >> But I'd like to be able to show the date of the next Sunday of every week.
> >> We have sales that end every Sunday and instead of having to manually change
> >> the date every week I'm trying to figure out how to just display the most
> >> recent Sundays date, if that makes sense.
> >>
> >> Anyone know how to do this? I've checked some javascript tutorials as well
> >> to see if it could be done with JavaScript but can't seem to find anything.
> >
> > You should check the documentation for the time tag:
> >
>
> Yeah I did that and I see how to adjust it so it always 3 hours ahead of the
> real time etc. but that's not really what I need. I guess what I need is an
> if/else statement that says;
> If day=Monday
> Add 6 days to the date
> Else if day=Tuesday add 5 days to the date
> Else if day=Wednesday add 4 days to the date
> Etc.
>
> Does anyone know how to do this?
[calc]
$time = $Tag->time('', {}, '%s');
$days = 7 - $Tag->time(undef, {time=>$time}, '%w');
$Tag->time(undef, {time => $time + $days * 86400}, '%A, %B %d, %Y');
[/calc]
Ciao
Racke
--
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team
More information about the interchange-users
mailing list