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 (  => 24  => 56  => 13  => 23  => 7  => 117  => 3  => 234  => 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] => 24 [tm_min] => 56 [tm_hour] => 13 [tm_mday] => 23 [tm_mon] => 7 [tm_year] => 117 [tm_wday] => 3 [tm_yday] => 234 [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