My table has date column in UTC time zone. I want to convert the data into PST. How to do this?
UTC time:
| date |
|---|
| 2017-06-26 17:35:47.0 |
| 2017-06-26 17:35:51.0 |
| 2017-06-26 17:28:04.0 |
| 2017-06-26 17:35:51.0 |
| 2017-06-26 17:35:45.0 |
| 2017-06-26 17:35:51.0 |
| 2017-06-26 17:35:51.0 |
| 2017-06-26 17:35:27.0 |
| 2017-06-26 17:35:27.0 |
| 2017-06-26 17:35:51.0 |
| 2017-06-26 17:35:51.0 |
| 2017-06-26 17:35:51.0 |
| 2017-06-26 17:35:51.0 |
For table test_table with column date_column containing datetime, to get local time from UTC you can use:
SELECT datetime(date_column,'localtime') as local_time from test_table;
Example with IST (UTC is 5 hours and 30 minutes behind of IST):
SELECT datetime(date_column||"-05:30") as local_time from test_table;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With