Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pFq6I-0001PT-2C for pgsql-general@arkaria.postgresql.org; Thu, 12 Jan 2023 05:26:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pFq6G-0004e9-Og for pgsql-general@arkaria.postgresql.org; Thu, 12 Jan 2023 05:26:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pFq6G-0004dz-CF for pgsql-general@lists.postgresql.org; Thu, 12 Jan 2023 05:26:04 +0000 Received: from mail-qt1-x836.google.com ([2607:f8b0:4864:20::836]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pFq69-0007em-Tf for pgsql-general@lists.postgresql.org; Thu, 12 Jan 2023 05:26:03 +0000 Received: by mail-qt1-x836.google.com with SMTP id h21so15568802qta.12 for ; Wed, 11 Jan 2023 21:25:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=O/SGaDd3DEmb+NMecApIXBVpK7HgCrpDi07debtEcsA=; b=Ynz1IDA9jTl0uiNs2prtuhAol4CRv4uq+sBiY5EXpo8zUvnh34LDf1UrkuCkj5Fqs4 YEO8HWnGkV9z09QWT7/ypOHDK+p50+XheO6LgEY8KfamK/Akw/KJuxykWbr72QVV3/zl tuScdZHfVw5TOeks021Znc7fkp7mhqiJO7ZK7xxQyBkUurw6luN3AQVyCPJRUDdZMcRl KcacbqV52cRl9N13cUY8KgdPmV8aWSKNkMErofMe1LNM6m4nk9sqRYYA8cm3cE2ETR8N w3RSzFkHuhnH6fnjuWSPUggnsSPgXyxyg12h/ivOqb0FtVnuprClnZTHHaYPdsJ1VTHh ntpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=O/SGaDd3DEmb+NMecApIXBVpK7HgCrpDi07debtEcsA=; b=JVAlQprClgSMgs+AURGqh/4UJd8cSKjgaDAdAPgCrDrTUfM91ZKFoFgv7bpuk80m2c /DzMSqEXW3ZV9o7JB2WHqfLWRhAEIa7HNLAZaraSgQATboOJC5UBGUVm0f1tRAUKduTa 5kRRU/WS9tFgqa7R4bZPK2OF7cevy6KafrwkSFK8pkK5baODqtMXvCyxK1G1o0J+R5M/ ji9aF6pOBACxCOowA86llNP9I5PCOyo/vmoawd96tHPrkktXrtOIwjdqF631ZvvYtWe5 Da5zyXCV778Mu5h1BrMkzKyMvhW4HTihlVrWWw2nf9iKlqoJePEhE5BcoXzMfoWBwBod 12Vw== X-Gm-Message-State: AFqh2kqNLCCuPlwErB50boI5+7I0FHPjFUnOWGjF6pG3+srDyw8JtHxl jYL9L33bjWQ2BrsME6n9seJfhjPzr0AAgQ== X-Google-Smtp-Source: AMrXdXsYA1GYsGbxcMMYtt7X97RORCMf4ZcLymwhyDenRqMqTlD7uYCyzRRbnGQWz7g7Cc3LWJEPjg== X-Received: by 2002:a05:622a:5c19:b0:3ad:d2d4:2503 with SMTP id gd25-20020a05622a5c1900b003add2d42503mr19725347qtb.7.1673501156173; Wed, 11 Jan 2023 21:25:56 -0800 (PST) Received: from [192.168.1.66] (108-250-206-84.lightspeed.nworla.sbcglobal.net. [108.250.206.84]) by smtp.googlemail.com with ESMTPSA id o24-20020a05620a229800b006fec1c0754csm10122162qkh.87.2023.01.11.21.25.55 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Jan 2023 21:25:55 -0800 (PST) Message-ID: <6a7ddac2-48e1-7339-5919-a69d6d7801ae@gmail.com> Date: Wed, 11 Jan 2023 23:25:55 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: Changing displayed time zone in RAISE NOTICE output? Content-Language: en-US To: pgsql-general References: <6b5f2616-f44a-10c5-974d-fc19cc493473@gmail.com> <0ccb4bf8-2f7f-7455-49ac-ff06cda36438@aklaver.com> From: Ron In-Reply-To: <0ccb4bf8-2f7f-7455-49ac-ff06cda36438@aklaver.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 1/11/23 15:06, Adrian Klaver wrote: > On 1/11/23 13:00, Ron wrote: >> How do I get clock_timestamp() to display the time in a different time zone? >> >> This is America/Chicago, but I'd like to display it in a different TZ. >> >> psql (12.12 (Ubuntu 12.12-1.pgdg18.04+1)) >> postgres=# DO $$ >> postgres$# BEGIN >> postgres$# RAISE NOTICE '%', clock_timestamp(); >> postgres$# END$$; >> NOTICE:  2023-01-11 14:52:34.408225-06 >> DO >> > > test(5432)=# select clock_timestamp(); >         clock_timestamp > -------------------------------- >  01/11/2023 13:05:54.646178 PST > (1 row) > > test(5432)=# select clock_timestamp() at time zone 'UTC'; >           timezone > ---------------------------- >  01/11/2023 21:06:04.742478 Hmm.  I'd have sworn this didn't work when I tried it: postgres=# postgres=# DO $$ BEGIN RAISE NOTICE '%', clock_timestamp() at time zone 'UTC'; END$$; NOTICE:  2023-01-12 05:22:40.517299 But it does work, so all's well that ends well. -- Born in Arizona, moved to Babylonia.