[ic] comparing dates
Grant
listbox at email.com
Thu Oct 2 17:48:48 EDT 2003
> Quoting Grant (listbox at email.com):
> >
> > > > I've been using some ITL that I wrote to determine if one date
> > > is a certain
> > > > number of days after today's date. It seems to work OK except
> > > one day when
> > > > it was screwing up. I can't help wondering if there's some kind of
> > > > functionality somewhere in IC or Perl that is more reliable.
> > > Does anyone
> > > > know of anything like that?
> > >
> > > I've used Date::Calc and Date::Manip from CPAN. Can't
> remember whether I
> > > liked one over the other.
> > >
> > > Jon
> >
> > I think that's what I was looking for. Thanks Jon!
>
> For something as simple as number of days, I think it is pretty easy
> with $Tag->time(), too:
>
> [calc]
> my $compare = $CGI->{date};
> my $numdays = $CGI->{days} || 5;
> my $future = $Tag->time( {
> body => '%Y%m%d%H%M%S',
> adjust => "$numdays days",
> });
> if($compare ge $future) {
> return "$compare IS $numdays days off (is > $future)";
> }
> else {
> return "$compare NOT $numdays days off (not > $future)";
> }
>
> [/calc]
>
> <p>
> [loop list="3 4 5 6 7 8 9"]
> [page href=@@MV_PAGE@@
> form=|
> days=[loop-code]
> date=[time adjust="+5 days"]%Y%m%d%H%M%S[/time]</a>
> |
> ]Check [loop-code] off from [time adjust="+5 days"/]</a><br>
> [/loop]
> </p>
That is awesome. Thank you!
- Grant
More information about the interchange-users
mailing list