[pmwiki-users] get page modification time in English, how?

SteP step.list+pmwiki at gmail.com
Sun Oct 28 13:21:10 CDT 2007


I think your recipe is what I was looking for, but I'm getting strange results.
I'm using it in a pagelist template, switching language from English to another language.
Everything works as expected, when English is the language, but when the other language is used
when="{=LastModified}" returns the current datetime for almost all pages. The only page for which the 
correct modification time is returned is an older page, as if PmWiki's lastmodified internal storage 
format had changed at some point in an incompatible way.  Here' the template, if you kindly could give 
it a shot

[[#news]]
(:template first:)
(:table align=left :)
(:template each:)
(:cellnr :)[[{=$FullName}|{=$Titlespaced}]] 
(:cell    :){(ftime when="{=$LastModified}"  lc="en")} - {(substr "{=$LastModified}" 0 5)}/{(substr "{=
$LastModified}" 8 2)} - {(ftime fmt="%d/%m" when="{=$LastModified}" lc="en")}
(:template last:)
(:tableend:)

This is the output I get in English

A 	 10/28/2007 12:12 PM - 10/28/07 - 28/10 
B	 08/24/2007 05:47 PM - 08/24/07 - 24/08 
C    	 14/01/2007 04:03 PM - 04/01/07 - 01/04 
D 	  02/15/2007 03:29 PM - 02/15/07 - 15/02

This is the output in another language

A 	28/10/2007 19:13 - 28/10/07 - 28/10 
B 	28/10/2007 19:13 - 24/08/07 - 28/10 
C 	04/01/2007 16:03 - 01/04/07 - 04/01 
D 	28/10/2007 19:13 - 15/02/07 - 28/10

wrote:

> SteP wrote:
>> Is there a way to get the last modification time of a page in
>> English? I need to convert the modification time for different
>> languages, I can use {(ftime...)} with a PTV, but I need the time in
>> English because ftime understands English only: {(ftime
>> fmt="{$:ftimefmt}" when="{=$LastModified}")} 
>> 
> 
> I'm not entirely sure I understand your question. ftime produces its
> output in the current locale, which usually defaults to English. If
> you need to be able to set the locale to output in (because you're
> using some other locale, for instance), I published a replacement for
> {(ftime ...)} that took a locale setting. You can look back a week or
> so in the archives for it, or you can just install the MarkupExprPlus
> cookbook recipe: 
> 
>   http://www.pmwiki.org/wiki/Cookbook/MarkupExprPlus
> 
> Which uses it. Then you can say
> 
>   {(ftime fmt="{$:ftimefmt}" when="{=$LastModified}" lc="en")}
> 
> To get English output.
> 
> If this isn't what you need, could you explain further?
> 





More information about the pmwiki-users mailing list