How to get server OS local time in all Postgres versions
<p>How to get server local time in char(8) format hh:mm:ss in every Postgres version.</p>

<p>In 9.1 it works:</p>

<pre><code>select current_time::char(8)
</code></pre>

<p>returns proper local time 13:46:00</p>

<p>In 9.5 it returns 3 hour different time:</p>

<p>10:46:00</p>

<p>select current_time, version() returns</p>

<pre><code>"10:48:40.181735+00";"PostgreSQL 9.5.2, compiled by Visual C++ build 1800, 32-bit"
</code></pre>

<p>and</p>

<pre><code>"13:48:51.775138+03";"PostgreSQL 9.1.2 on x86_64-unknown-linux-gnu, compiled by gcc-4.4.real (Debian 4.4.5-8) 4.4.5, 64-bit"
</code></pre>

<p><strong>Update</strong></p>

<p>Both servers use default postgres.conf settings for time.
postgres.conf does not contain timezone settings.</p>

<p>in 9.5 Windows 10 it contains</p>

<pre><code>#timezone = 'GMT'
#timezone_abbreviations = 'Default'     
</code></pre>

<p>in 9.1 Debian it contains</p>

<pre><code>#timezone = '(defaults to server environment setting)'
#timezone_abbreviations = 'Default'
</code></pre>

<p>How to get server local time in 9.5 when default postgresql.conf file is used ?</p>

<p>It looks like server does not use OS setting in 9.5</p>

<p>How to force 9.5 to ask timezone from OS and return time in this zone?</p>