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 (  => 11  => 56  => 7  => 16  => 0  => 118  => 2  => 15  => 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] => 11 [tm_min] => 56 [tm_hour] => 7 [tm_mday] => 16 [tm_mon] => 0 [tm_year] => 118 [tm_wday] => 2 [tm_yday] => 15 [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