Dates

Short Description
Provides functions relating to specific dates and times

In several places (forum, private messages, last revision date, …) Wikidot pages use dates and timestamps that automatically calculate (either when hovering with the mouse or directly in the text) how long ago this was. Examples are

  • 1237135440|%e %b %Y, %H:%M %Z|agohover (move the mouse over the date to see the hovering text), or

  • 1237135440|%c.

If you want dates that you type on your pages to also automatically show “how long ago”, here is how you can do it.

How it Works

The syntax needed is

[[date timestamp <format="format<|agohover>">]]

where

  • < … > denote optional parameters
  • timestamp is the number of seconds between Jan 1, 1970 and the wanted date. To find this number for a specific date, see Code Wizard below
  • format is an arbitrary text string that may include %modifiers, which are replaced by an actual (part of the) date or time. If not specified, format defaults to “%e”
  • |agohover when specified displays a “hovering” text (“nn seconds/minutes/hours/days ago”) when the mouse is moved over any part of the displayed format string.

Code Wizard

To find out what code you should use on your page for a specific date,

Then copy/paste the displayed code into your page.

Examples

What you type … What you get …
[[date 1216153821]] 1216153821
[[date 1216153821 format="%d. %m. %Y|agohover"]] 1216153821|%d. %m. %Y|agohover
[[date 681818400 format="James is %O young"]] 681818400|James is %O young
+++ Minutes from [[date 1234567890 format="%e %B|agohover"]] Minutes from 1234567890|%e %B|agohover

Limitations

Note that currently

  • the “how long ago” value for dates that lie in the future is clumsy (it's displayed as e. g. 1255555555|%O) and
  • dates before Jan 1, 1970 are not rendered at all

Author
created by ErichSteinboeckErichSteinboeck

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License