'How to convert timezone using sql query using only destination timezone parameter only?
I have one sql query in which i have user timezone in which i have to retrieve date and time. Means i have to convert date and time to specific user_timezone. As per doc CONVERT_TZ() this function required from_timezone and to_timezone but i have only to_timezone parameter so how can i convert user date and time to specific time zone using mysql query. Below is the my sql query in which i need to implement. So can anyone help me to resolve this issue ?
SELECT cpv.*, DATE_FORMAT(watchStartTime, '%Y-%m-%dT%H:%i:%s.000Z') as watchStartTime, DATE_FORMAT(watchEndTime, '%Y-%m-%dT%H:%i:%s.000Z') as watchEndTime, DATE(watchStartTime) as watchDate, DAYNAME(watchStartTime) as watchDay FROM ClientProgramVideo AS cpv LEFT JOIN ClientProgramMapping AS cpm ON cpm.id = cpv.clientProgramMappingId LEFT JOIN User AS u ON u.id = cpm.clientId WHERE u.sub = '8851de3e-459a-9a84-51ce99f83284' AND cpv.isCompleteWatch = 1 AND cpv.watchStartTime > '2021-04-20T07:10:03.000Z' GROUP BY DATE(watchStartTime) ORDER BY cpv.watchStartTime DESC;
In above query i need to convert timezone form "watchStartTime" and watchEndTime
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
