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  => 16  => 22  => 16  => 6  => 118  => 1  => 196  => 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] => 16 [tm_hour] => 22 [tm_mday] => 16 [tm_mon] => 6 [tm_year] => 118 [tm_wday] => 1 [tm_yday] => 196 [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