Reputation: 1795
I have a datetime column in MySQL table in Y-m-d H:i:s
UTC format:
SELECT `transaction_time` FROM `transaction` LIMIT 1;
//2018-10-12 09:36:12
the above wil show my database record which i alreade save in UTC format, how can i show it in GMT+7 format ?
Upvotes: 2
Views: 6606
Reputation: 145
You can use CONVERT_TZ() method.
Select CONVERT_TZ(`transaction_time`,'+00:00','+07:00') from `transaction` LIMIT 1;
Upvotes: 1
Reputation: 36
You can use CONVERT_TZ()
function:
SELECT CONVERT_TZ(transaction_time, '+00:00', '+07:00') FROM transaction LIMIT 1;
You can read more about CONVERT_TZ()
function here.
Upvotes: 0