If you have a stored DATE
or DATETIME
(in a column somewhere) it was stored with respect to some time zone, but in MySQL the time zone is not stored with the value. So, if you want to convert it to another time zone, you can, but you must know the original time zone. Using CONVERT_TZ()
does the conversion. This example shows rows sold in California in local time.
SELECT CONVERT_TZ(date_sold,'UTC','America/Los_Angeles') date_sold_local
FROM sales
WHERE state_sold = 'CA'