This is really easy. All TIMESTAMP
values are stored in universal time, and always converted to the present time_zone
setting whenever they are rendered.
SET SESSION time_zone='America/Los_Angeles';
SELECT timestamp_sold
FROM sales
WHERE state_sold = 'CA'
Why is this? TIMESTAMP
values are based on the venerable UNIX time_t
data type. Those UNIX timestamps are stored as a number of seconds since 1970-01-01 00:00:00
UTC.
Notice TIMESTAMP
values are stored in universal time. DATE
and DATETIME
values are stored in whatever local time was in effect when they were stored.