Timestamp: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
cat
X! (talk | contribs)
moved to MediaWiki
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{MovedToMediaWiki|Manual:Timestamp}}
This is useful for converting Mediawiki timestamps (yyyymmddhhmmss) to human readable format.

<?php
$year = substr($timestamp, 0, 4);
$month = substr($timestamp, 4, 2);
$day = substr($timestamp, 6, 2);
$hour = substr($timestamp, 8, 2);
$minute = substr($timestamp, 10, 2);
$second = substr($timestamp, 12, 2);
$date = date('M d, Y H:m:s', mktime($hour, $minute, $second, $month, $day, $year));
?>

* extended from http://www.hawkee.com/snippet.php?snippet_id=427

[[category:time]]

Latest revision as of 19:24, 12 August 2009