From 971315e4f584154cedd311e7df26c84451b4470c Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Wed, 10 Oct 2012 09:50:39 +0200 Subject: [PATCH] Add an example of using raw_field to the format_date function documentation. --- manual/template_lang.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/manual/template_lang.rst b/manual/template_lang.rst index fe62547ef1..b4926b8e42 100644 --- a/manual/template_lang.rst +++ b/manual/template_lang.rst @@ -271,6 +271,8 @@ The following functions are available in addition to those described in single-f ap : use a 12-hour clock instead of a 24-hour clock, with 'ap' replaced by the localized string for am or pm. AP : use a 12-hour clock instead of a 24-hour clock, with 'AP' replaced by the localized string for AM or PM. iso : the date with time and timezone. Must be the only format present. + + You might get unexpected results if the date you are formatting contains localized month names, which can happen if you changed the format tweaks to contain MMMM. In this case, instead of using something like ``{pubdate:format_date(yyyy)}``, write the template using template program mode as in ``{:'format_date(raw_field('pubdate'),'yyyy')'}``. * finish_formatting(val, fmt, prefix, suffix) -- apply the format, prefix, and suffix to a value in the same way as done in a template like ``{series_index:05.2f| - |- }``. This function is provided to ease conversion of complex single-function- or template-program-mode templates to :ref:`general program mode ` (see below) to take advantage of GPM template compilation. For example, the following program produces the same output as the above template::