[ic] Date time stamp
Stefan Hornburg
racke at linuxia.de
Mon Jan 5 15:47:19 EST 2004
On Mon, 05 Jan 2004 11:30:25 -0800
Anthony Minero <anthony at urbanscooters.com> wrote:
>
>
> > On Mon, 05 Jan 2004 10:26:30 -0800
> > Anthony Minero <anthony at urbanscooters.com> wrote:
> >> 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?
> >
> > On 1/5/04 11:07 AM, "Stefan Hornburg" <racke at linuxia.de> wrote:
>
> > [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
> >
>
> Great, that works. I'm not sure how it's working exactly but it shows
> Sundays date and I'm assuming it just detects today's date and changes the
> $time tag accordingly?
#1 stores number of seconds since epoch in $time
#2 determines weekday and stores days until Sunday in $days
#3 finally formats $time with an offset of $days (1 day = 86400 seconds)
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