When exchanging data in the database, it is often necessary to put the adding time information of the data into the input data, so how to get the current time? You can use the getdate()
function to obtain it. This article will take you to take a look. First, we need to understand the syntax of getdate()
getdate ( int $timestamp = time() ) :
$timestamp: optional, the parameter is an int Unix timestamp, if not specified or null, The parameter value defaults to the current local time.
Return value: Returns an associative array array containing date information based on $timestamp
Code example:
<?php $today = getdate(); print_r($today); ?>
输出:Array ( [seconds] => 23[minutes] => 57[hours] => 3 [mday] => 28wday] => 3[mon] => 4year] => 2021[yday] => 117 [weekday] => Wednesday[month] => April[0] => 1619582243 )
Recommended: 《2021 PHP interview questions summary (collection)》《php video tutorial》
The above is the detailed content of Parsing the getdate() function in PHP. For more information, please follow other related articles on the PHP Chinese website!