Search code examples
perldatetimeisotemplate-toolkit

template-toolkit datetime in ISO format as input


Is there an easy way to have template-toolkit accept date/times in ISO 8601 format as input?

http://en.wikipedia.org/wiki/ISO_8601

Specifically I'm looking for the combined date/time format assuming UTC time:

yyyy-mm-ddThh:mm:ssZ

and then have TT adjust timezone & formatting based on locale.


Solution

  • Sure, you should use DateTime module, and DateTime::Format::Strptime to parse and format (transform from DateTime to string and viceversa.