473,796 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TIMEZONE not working?

Hi!

If I correctly understand v7.4 manual, value, say,
'2003-11-26 12:00' in TIMESTAMP WITHOUT TIMEZONE column
should output '2003-11-26 19:00' for "+08:00" timezone.

The following test results seem to be somewhat unexpected.
Restting OS timezone (/etc/timezone and /etc/localtime in
Linux) does not make the results more comfortable.

The display in Windowz for the result set SELECTed from
PostgreSQL running on Linux is the same as that in psql
prompt - being always UTC value. Query 'SET SESSION TIMEZONE
TO 8' is sent to the backend after the connection with the
backend is established and before query 'SELECT * FROM ..'
is sent to the backend, of course.

Any idea would be much appreciated!

Regards,

CN
=============
db1=# \d test
Table "public.tes t"
Column | Type | Modifiers
--------+-----------------------------+-----------
f1 | timestamp without time zone |

db1=# SHOW TimeZone;
TimeZone
----------
unknown
(1 row)

db1=# SET TIME ZONE CCT;
ERROR: unrecognized time zone name: "cct"
db1=# SET TIME ZONE 'CCT';
ERROR: unrecognized time zone name: "CCT"
db1=# SET TIME ZONE TO 'JST';
ERROR: syntax error at or near "TO" at character 15
db1=# SET TIME ZONE 8;
SET
db1=# SHOW TimeZone;
TimeZone
----------
08:00:00
(1 row)

db1=# INSERT INTO test VALUES ('2003-11-26 13:00');
INSERT 40397 1
db1=# SHOW DateStyle;
DateStyle
-----------
ISO, MDY
(1 row)

db1=# SET DateStyle 'ISO, YMD';
ERROR: syntax error at or near "'ISO, YMD'" at character 15
db1=# SET DateStyle TO 'ISO, YMD';
SET
db1=# SELECT * FROM test;
f1
---------------------
2003-11-26 13:00:00
(1 row)

db1=# SET DateStyle TO 'ISO, DMY';
SET
db1=# SHOW DateStyle;
DateStyle
-----------
ISO, DMY
(1 row)

db1=# SELECT * FROM test;
f1
---------------------
2003-11-26 13:00:00
(1 row)

db1=# SET TimeZone TO -1;
SET
db1=# SHOW Timezone;
TimeZone
-----------
-01:00:00
(1 row)

db1=# SELECT * FROM test;
f1
---------------------
2003-11-26 13:00:00
(1 row)

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #1
1 4034
"cnliou" <cn****@so-net.net.tw> writes:
If I correctly understand v7.4 manual, value, say,
'2003-11-26 12:00' in TIMESTAMP WITHOUT TIMEZONE column
should output '2003-11-26 19:00' for "+08:00" timezone.


Not at all. TIMESTAMP WITHOUT TIMEZONE will not react to timezone
environment at all. What part of the docs gave you another impression?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3206
by: Jim Davis | last post by:
I'm (still) working on an ISO 8601 date parser. I want to convert at least the formats described here: http://www.w3.org/TR/NOTE-datetime Well.. I've got most of it working (via RegEx's) good enough for me but I'm having a brain block when it comes to TimeZone. The datetime may come with an optional timezone offset (from GMT) as here (the offset is +1 hour from GMT):
13
14487
by: Stuart Bishop | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi. I'm trying to determine the best way of saying 'The current time in UTC with no time zone information'. I'm currently using CURRENT_TIMESTAMP AT TIME ZONE 'UTC' and inserting into columns defined as TIMESTAMP WITHOUT TIME ZONE which appears to
2
4775
by: David Garamond | last post by:
When a timestamp string input contains a timezone abbreviation (CDT, PST, etc), which timezone offset is used? The input date's or today date's? The result on my computer suggests the latter. # create table ts (ts timestamptz); # insert into ts values ('2004-10-17 00:00:00 CDT'); -- UTC-5 # insert into ts values ('2004-11-17 00:00:00 CDT'); -- UTC-6 # select ts at time zone 'utc' from ts; timezone ---------------------
3
8341
by: asanford | last post by:
I want to create a web service that allows the caller to pass a DateTime to the web service (that is, create a web method such as void MyWebMethod(DateTime dt).) However, I want to be able to capture the TimeZone of the caller as well - but I don't want the interface to specify an xs:string as the method argument - I want it to use an xs:dateTime type argument. Now, I know when a DateTime structure is serialized into XML it becomes an...
0
3219
by: helloitsme | last post by:
Hello All! I know there already exists a thread with this topic by Mike! But my problem did not get solved with that.... I have a working code in VB6 that can set the selected timezone for the system. When i converted that code in VB .NET, I am having a problem similar to what Mike was having. When I select my timezone to Eastern Time Zone (or SA Pacific), my code sets my system timezone to 'Bogota, Lima, Quito'. i guess it is becoz both...
2
5173
by: Michele Locati | last post by:
Hi to everybody I'm working with dates and time, and I can't find the way to determine the time in a generic TimeZone. Here's an example of what I'd like to do: // I get the local date and time DataTime NowHere = DateTime.Now;
3
5579
by: cmccarthy | last post by:
Hello all, I have search for hours over the internet trying to find a solution with no luck. I am hoping someone here may have to the knowledge to help me with this problem. I am trying to add the date to my site using PHP with a default timezone (the clients). Currently I have: <?php echo date("m.d.y T"); ?> Which prints: 08.06.07 CDT
1
6569
by: Abdullah Kamran | last post by:
I have found a method to find the timezone using longitude of a place from somewhere. I tried it to do some calculations and found it working, it is not very accurate though (needs some improvements) The timezone changes every 15 degrees on longitude either way. The formula to find timezone is: (longitude/15) * 3600; This will give you timezone (or time differnce from GMT) in seconds. And can be used in calculations. Hope this will...
2
3689
by: =?Utf-8?B?Sm9ubnk=?= | last post by:
I have an ASP.NET 2.0 C# web application that is contacting an Exchange server using WEBDAV. It allows the users to look up appointments for a future date. The problem I have is determining the correct client time zone. Note that Exchange stores everything in UTC time. I am able currently able to use javascript to ask the client what time zone they are in, but this is only for the "today" (the current day) and not for a day in the...
0
9528
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10173
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10006
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.