Mysql Query For Timezone Conversion
is there a way to convert from unix timestamp to GMT in mysql while running the query itself?? My query is as follows: SELECT r.name , r.network , r.namestring , i.name ,
Solution 1:
Using FROM_UNIXTIME converts a UNIX timestamp to a MySQL DATETIME:
FROM_UNIXTIME(r.unixtime)
Then you can use CONVERT_TZ to get the DATETIME in a different timezone:
CONVERT_TZ(FROM_UNIXTIME(r.unixtime), ?,'GMT')
Problem is, you need to know the original timezone is - you have to update the ?
with the correct timezone...
Post a Comment for "Mysql Query For Timezone Conversion"