I think the easiest way to handle dates in TTK is to use DateTime.pm. I just pass a Perl subroutine that creates a DateTime object as one of the TTK params. That way my templates can use the nice, consistent methods in DateTime. Once you get used to it, DateTime is much clearer than Date::Calc or Date::Manip, tho it doesn't understand "next Tuesday" and suchlike, as Date::Manip does.

http://search.cpan.org/author/DROLSKY/DateTime-0.2901/lib/DateTime.pm

Bruce

ecocode wrote:
Hi,

This is what I want to do ... but could this be done without using
[%PERL%] ??

[% PERL %]
use Date::Calc qw(Today_and_Now Add_Delta_DHMS Day_of_Week_to_Text Day_of_Week 
Month_to_Text);
my ($y,$m,$d,$H,$M,$S) = Add_Delta_DHMS(Today_and_Now(), +7,-5,+30,0) ;
my $dow = Day_of_Week_to_Text(Day_of_Week($y,$m,$d));
my $mt = substr(Month_to_Text($m),0,3) ;
my $dw = substr($dow,0,3) ;
print "$dw, $d $mt $y 13:00:00"
[% END %]

Thanks

--
Bruce McKenzie
http://www.2MinuteExplainer.com

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to