Home > database >  Why the database read timestamp type data values are different in different time zones
Why the database read timestamp type data values are different in different time zones

Time:09-21

I did an experiment,
In have Zhang Xuesheng orale database table. One of the field is the timestamp type
1. Set the current time zone to GMT + 1.
TimeZone. SetDefault (TimeZone. GetTimeZone (GMT + 1 "));
2. In the a record to the table,
3. The system's time zone to GMT + 0.
4. Read setp2 insert data,

Found that the time value of time field is larger than before 36000 milliseconds, just insert and read time difference, I don't know why?

CodePudding user response:

You of the insert statement and select statement, and build table statements are coming;

CodePudding user response:

In the Oracle, and MySQL timestamp is the function of different

Oracle, the TIMESTAMP is one of the higher precision of the date storage, as datetime extension, but it doesn't store time zone information

Oracle, TIMESTAMP WITH TIME ZONE TIME ZONE information storage

Oracle, TIMESTAMP WITH the LOCAL TIME ZONE will not store TIME ZONE information, the TIME data into the database TIME ZONE TIME data for storage, but not to store TIME ZONE information; Client retrieval, the oracle database will be stored in the time of the session time zone data into the client data returned to the client after

MYSQL, the TIMESTAMP is for less storage unit (DATETIME is 4 bytes, TIMESTAMP is 1 byte) but at some of the beginning of the range of 1970 to 2037 years, and the return value judgement may according to the client's TIME ZONE, MYSQL and ORACLE sensitive TIMESTAMP TIME ZONE this TIMESTAMP WITH the LOCAL TIME ZONE,
Original: https://www.cnblogs.com/scoopr/p/5592339.html
  • Related