Switching Timezones in Perl's Template::Toolkit plugin Template::Plugin::Date

Posted by aidan on Stack Overflow See other posts from Stack Overflow or by aidan
Published on 2010-03-17T18:39:58Z Indexed on 2010/03/17 19:01 UTC
Read the original article Hit count: 514

Filed under:
|
|

I have a calendar on my website, generated in Perl using Template::Toolkit and Template::Plugin::Date.

It highlights the current day. I achieve this by iterating through all the dates (as I print the calendar) and comparing against the current date. Something like this:

[% IF cur_date == date.format(format = '%Y-%m-%d') %]
...
[% END %]

It all works well until someone in Australia looks at it. (They are in a different timezone to me and my server in the UK).

What's the best way to get Template::Plugin::Date to use a different time zone? It accepts a 'locale' parameter, but AFAIK this is only used for formatting.

© Stack Overflow or respective owner

Related posts about perl

Related posts about timezone