Last modified: 2006-08-27 20:22:51 UTC
Bug 7114 comment #4, by Tim Starling: > I have a better idea: a parser function called #time. It takes one required > parameter and one optional parameter. The required parameter is a date format in > the style of Language::sprintfDate(), which is the internationalised date > formatter I wrote a few weeks ago. The optional parameter is a string date as > accepted by strtotime(), the same function we use for block expiries. strtotime() > accepts both relative and absolute dates, so it could do timezone conversions. > > For example, you could find out what time it is here in Melbourne with: > > {{#time:H:i|+10 hours}} > > This is very simple to code, just a few lines. Bug 7114 comment #6, by me: > If you do this, how about adding U to the list of supported formatting > characters? That would mean date arithmetic would be possible via {{#time: > Y-m-d H:i:s|@{{#expr: {{#time:U|2007-09-25 15:51:01}} - {{#time:U|2006-08-24 > 14:50:00}} }} }}, which is hardly elegant and not particularly efficient but > should be usable. (Why not support all PHP's formatting characters anyway? > It's not as though cases after the one you hit are going to affect performance, > I assume.) Split into a new bug, and I'll dupe all the "{{CURRENTx}}" requests pending to this.
*** Bug 5733 has been marked as a duplicate of this bug. ***
*** Bug 5755 has been marked as a duplicate of this bug. ***
Oh, right, some explanation for non-programmers. Basically this would allow you access to either PHP's date() function or else a more internationalized MediaWiki-specific equivalent. See <http://www.php.net/manual/en/function.date.php> for a general idea of how this will work: give it a date, get back the same date formatted however you specify. For how date entry will work, see <http://www.php.net/manual/en/function.strtotime.php>; basically any unambiguous date format will be accepted.
*** Bug 6693 has been marked as a duplicate of this bug. ***
*** Bug 7115 has been marked as a duplicate of this bug. ***
*** Bug 3453 has been marked as a duplicate of this bug. ***
Added in r16219.