PHP timestamp
PHP timestamp generally refers to the UNIX timestamp. The Unix epoch is 00:00:00 on January 1, 1970. Get the PHP timestamp of a certain point in time, which represents the point in time and the Unix epoch. The time difference is usually measured in seconds. The way to get PHP timestamp is very simple. PHP has built-in functions to get timestamp. For example, time function and mktime are both very useful. timestamp Timestamp is a very useful technique used by PHP to calculate the time difference, and it has been used in early versions of PHP. It is also the basis of PHP. Below we use the time function and mktime as examples for your reference.
PHP timestamp Example of obtaining a timestamp 1. Using the time function
echo'<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'; //Web page encoding
echo'current Unix timestamp:'.time().'< br>'; //Current Unix timestamp
?>
PHP timestamp timestamp obtaining example two, using mktime
echo'<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'; //Web page encoding
echo mktime(date("H"),date("i "),date("s"),date("n"),date("j"),date("Y")).'<br>';
echo mktime();
?>
current Unix timestamp: 1412666448
Post a Comment
0 Comments