[Mediawiki-l] DateTime calculation?

Emanuele D'Arrigo manu3d at gmail.com
Fri Aug 17 14:41:57 UTC 2007

On 8/17/07, Emanuele D'Arrigo <manu3d at gmail.com> wrote:
> On 8/17/07, Rob Church <robchur at gmail.com> wrote:
> > On 17/08/07, Thomas Dalton <thomas.dalton at gmail.com> wrote:
> > > Lots of {{#if}} statements? There may be a better way... A
> > > {{UNIXTIME}} variable giving seconds since the epoch would be very
> > > useful... I'm surprised there isn't one already, but it shouldn't be
> > > difficult to add.
> >
> > {{#time}} ?

Ok, I just tried to go down that route. {{#time}} indeed can output the
number of seconds from the epoch, on which I can then do some
arithmetics. The problem is that the output will be again in seconds
since the epoch, which is not something I can provide back to {{#time}}
as input. I.e. the following, trying to get a date from one week ago,
works up to the #expr but doesn't go further:


Am I missing something else?

...few minutes later...

Gosh, I did miss quite a lot!!!

{{#time:}} also has offsets such as {{#time:YmdTHis|-7 days}} which
are exactly what I needed! Ok, my little brand new extension is
completely redundant and will never see the light of mediawiki.org.
My fault, I should have read about  {{#time:}} far more thoroughly.

Thanks for your help guys!


More information about the MediaWiki-l mailing list