localtime()We can get local time with date, month year etc ( array output ) by using localtime() function in PHP.
Here is the syntax.
print_r(localtime());The output of above code is here
Array (  => 0  => 22  => 2  => 23  => 9  => 117  => 1  => 295  => 0 )We can get better output by using is_associative to true. We will get a set of keys and associated data. Here is an example.
print_r(localtime(time(),true));The output is here.
Array ( [tm_sec] => 0 [tm_min] => 22 [tm_hour] => 2 [tm_mday] => 23 [tm_mon] => 9 [tm_year] => 117 [tm_wday] => 1 [tm_yday] => 295 [tm_isdst] => 0 )We can change the time zone set and check the return like this.
The ouput is here
More On Date Object
PHP Date & Time class creating and examples of uses
Creating a date interval object and using with php date object
Adding date interval to date object to create new dates
Difference in date by using diff function and using date object
Add or subtract from date object using modify function
Changing parameters of the date object by using setdate function
updating time for a date object to a new value
Gettign the time zone setting of the server
Setting the default time zone of server
Array of time zones available for setting ( total list )
Getting time in seconds elapsed from Epoch time
Local time of the server or different time zones by using localtime() function