Manual:WfTimestamp/zh

概要
(part of GlobalFunctions.php) provides functionality to convert between common timestamp formats, including MediaWiki timestamps, UNIX timestamps, MySQL   format, RFC 2822 format and more. 有关完整列表，请参阅下面的 格式.

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. 改用$dbw->timestamp

用法

 * 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.

格式


参见

 * source docs for wfTimestamp