Sure, you should use DateTime module, and DateTime::Format::Strptime to parse and format (transform from DateTime to string and viceversa.
template-toolkit datetime in ISO format as input
-
24-06-2022 - |
题
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.
解决方案
其他提示
This appears to work, but it's a bit kludgy:
<% USE date %>
...
<% date.format(mydatetime.substr(0,10) _ ' ' _ mydatetime.substr(11,8), '%c', 'en_US') %>
Open to other suggestions. Assumes en_US as locale.
不隶属于 StackOverflow