date() returns incorrect value if used from WordPress theme, but correct otherwise

OK, I found the answer myself. Turns out that in WordPress the UTC time is hardcoded and thus using PHP’s date() will always return UTC. Instead you should use WP’s function current_time(). Here are more details