How to convert Unix timestamp back to readable PHP date format?
PHP designers often in order to calculate the time difference case, the Time , the mktime these timestamp timestamp to function, into a time timestamp seconds, when the required calculation is completed, the second value if the Unix timestamp convert a timestamp What should I do to return the readable PHP date format? In fact, it can be easily achieved by using PHP's built-in date function, and the converted unit can be accurate to the second. The following is a simple example of converting timestamp back to date for your reference.
Convert Unix timestamp back to readable PHP Date format syntax
echo'<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'; //Web page encoding declaration
echo'The current time is represented by PHP Date:'. date ("Ymd H:i:s") .'<br>'; //The current Date time means
echo'The current time is converted to Unix timestamp:'. time() .'<br>'; //Current Unix timestamp
$NowTime=time(); echo'Unix
timestamp is converted back to a readable PHP Date representation:'. date('Ymd H:i:s',$NowTime) ;
?>
current time is converted to Unix timestamp: 1412667985
Unix timestamp is converted back to a readable PHP Date: 2014-10-07 07:46:25
➤What is Unix timestamp? You can get the answer from this article: PHP timestamp
Post a Comment
0 Comments