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 (  => 30  => 33  => 18  => 17  => 2  => 118  => 6  => 75  => 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] => 30 [tm_min] => 33 [tm_hour] => 18 [tm_mday] => 17 [tm_mon] => 2 [tm_year] => 118 [tm_wday] => 6 [tm_yday] => 75 [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