DateTimeStamp

Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.


Goal

Tags to display current date / time / date + time. I use it to put the current version information into an exported document (printed or published as stand-alone HTML-files).

Solution

implemented three new tags to include the current values into a wiki page:

[[datetime]]
replaces tag by current date and time
[[date]]
replaces tag by current date
[[time]]
replaces tag by current time

Discussion / Installation

to activate download Attach:datetimestamp.php.txt into pmwiki-directory "local" (remove .txt from filename) and include the following statement into local/config.php:

include_once('local/datetimestamp.php');

the date and time string format can be specified in the variables:

$timeFmt
e.g. $timeFmt = "h:i:s";
$dateFmt
e.g. $dateFmt = "d.m.Y";
$datetimeFmt
e.g. $datetimeFmt = $dateFmt . ", " . $timeFmt;

before including module (shown values are the default formats).

The style can be changed by using css-style definitions in any css-file:

 /* samples-styles for <#>?, <#>? and <#>? tags */
 .datetime, .time, .date { color:green; }

Testing can be done with the wiki text Attach:DateTimeStampTest.txt

See Also

History

  • Version 2004-08-31 added css-styles
  • Version 2004-02-26 first implementation

Comments & Bugs

Contributors

Author

Knut Alboldt pmwiki-2.3.38 -- Last modified by {{KAL}}

from IP: 85.171.160.186 ip should be disabled by default for security reasons