X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 131C8D1B437 for ; Tue, 2 Dec 2003 18:06:52 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 62973-06 for ; Tue, 2 Dec 2003 14:06:25 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 388DCD1B470 for ; Tue, 2 Dec 2003 14:06:20 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id hB2I6P19022899; Tue, 2 Dec 2003 13:06:26 -0500 (EST) To: cnliou@so-net.net.tw Cc: "" Subject: Re: Inserting timestamp values from windowz application In-reply-to: <1070386056.30928.cnliou@so-net.net.tw> References: <1070386056.30928.cnliou@so-net.net.tw> Comments: In-reply-to "cnliou" message dated "Wed, 03 Dec 2003 01:27:36 +0800" Date: Tue, 02 Dec 2003 13:06:25 -0500 Message-ID: <22898.1070388385@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/8 X-Sequence-Number: 4617 "cnliou" writes: > After project1.exe connects to postgres via libpq.dll, the > query > SHOW TIME ZONE > returns "unknown", which is as expected. Then I do the > insert from project1.exe: > INSERT INTO test VALUES (CAST('2003-1-1' AS TIMESTAMP)); > What weird is that this datetime value is saved to column c1 > as 2002-12-31 16:00:00 UTC. This means that your system default timezone is UTC+8. The fact that SHOW TIME ZONE returns "unknown" does not mean that your time zone setting is UTC. It means that the standard C library interface doesn't provide any way to find out the setting in string form :-(. SHOW TIME ZONE can tell you something useful if either (1) you've done a SET TIME ZONE, or (2) the variable TZ is defined in the postmaster's environment. Otherwise it says "unknown" ... but the C library nonetheless will find a time zone setting from someplace. > I need a "manual" way to explicitly tell postgres the > client's time zone by sending from project1.exe the query > "SET TIME ZONE -5" or the like to postgres. What's so hard about that? regards, tom lane