Return the current time as a Unix timestamp, then format it to a date:
<?php
$t=time();
echo($t . "<br>");
echo(date("Y-m-d",$t));
?>
Try it Yourself »
The time() function returns the current time in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
time()
Return Value: | Returns an integer containing the current time as a Unix timestamp |
---|---|
PHP Version: | 4+ |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!