In PostgreSQL1 and assuming a simplified scenario to concentrate on converting your timestamps to IST
such is this one:
CREATE TABLE locations
(
id serial PRIMARY KEY,
your_timestamp timestamp with time zone
) ;
NOTE: don't use timestamp
as a column name, to avoid confusions. timestamp
is already a type
.
INSERT INTO locations
(your_timestamp)
VALUES
('2017-01-01 10:00:00 UTC'),
('2017-01-01 10:00:00 Europe/Rome'),
('2017-01-01 10:00:00 America/New_York'),
('2017-01-01 10:00:00 IST') ;
You'd convert all those times (not only the ones already entered as UTC, or with the local time zone of the client connecting to the database), you would use:
SELECT
id,
your_timestamp,
your_timestamp AT TIME ZONE 'UTC' AS timestamp_utc,
your_timestamp AT TIME ZONE 'IST' AS timestamp_ist
FROM
locations ;
id | your_timestamp | timestamp_utc | timestamp_ist
-: | :--------------------- | :------------------ | :------------------
1 | 2017-01-01 10:00:00+00 | 2017-01-01 10:00:00 | 2017-01-01 12:00:00
2 | 2017-01-01 09:00:00+00 | 2017-01-01 09:00:00 | 2017-01-01 11:00:00
3 | 2017-01-01 15:00:00+00 | 2017-01-01 15:00:00 | 2017-01-01 17:00:00
4 | 2017-01-01 08:00:00+00 | 2017-01-01 08:00:00 | 2017-01-01 10:00:00
You can check it at dbfiddle here
References:
1 I don't know the MySQL equivalent. I hope you actually are using PostgreSQL, since your identifiers are "double quoted"
and not `backtick quoted`
as in MySQL.