Q:

date() function in PHP and its 2nd parameter

PHP date() documentation says: 

timestamp
  The optional timestamp parameter is an integer Unix timestamp that defaults to the current local time if a timestamp is not given. In other words, it defaults to the value of time().

I'm using server located in Belgrade (timezone in php.ini is "Europe/Belgrade") which is UTC+2 currently:
echo date('F j, Y, H:i - e') // result => March 30, 2016, 18:22 - Europe/Belgrade

Now I would like to get UTC time. If we know that time() always defaults to UTC time and it's same on all servers, I should be able to do this to get UTC time: 
echo date('F j, Y, H:i - e', time()); // result => March 30, 2016, 18:22 - Europe/Belgrade

but result is the same. I was supposed to get March 30, 2016, 16:22 - UTC. In docs it says: 

The optional timestamp parameter is an integer Unix timestamp that
  defaults to the current local time if a timestamp is not given

but if it's given, it should default to what's given, isn't that right? 

A:

In date('F j, Y, H:i - e', time());, time() is still resolving to your current server time which from your first code is March 30, 2016, 18:22 - Europe/Belgrade. Therefore, essentially, your code is still the same; as date('F j, Y, H:i - e' [, $timestamp = time()]) is treated as date('F j, Y, H:i - e', time()); since there is no second parameter. To get UTC time, I will suggest you use 
echo gmdate('F j, Y, H:i - e'); //will output March 30, 2016, 16:22 - UTC
rather

