Manual:WfTimestamp/en

Overview
(part of GlobalFunctions.php) provides functionality to convert between common timestamp formats, including MediaWiki timestamps, UNIX timestamps, MySQL   format, RFC 2822 format and more. See formats below for a full list.

Timestamps will be output without a timezone or in the GMT timezone, as specified by the particular format.

Never use wfTimestamp when inserting a timestamp into the database.This will break in Postgres and possibly other non-MySQL databases.Instead use $dbw->timestamp

Usage
 


 * Returns a timestamp of type string in the format specified by the  argument.
 * Throws  if an incorrect formats is passed via the   argument.
 * Returns  if an invalid or unrecognized timestamp is passed via the   argument.


 * Call with no arguments to return the current time in UNIX time format.


 * Call with one argument to return the current time in the specified format.


 * Call with two arguments to return an arbitrary timestamp in the specified format.

Note that the timestamp can be in any format that  can output.