I want to convert my record entries from datetime+OFFSET to datetimeZ directly
(2008-05-11T15:30:00+2 ---> 2008-05-11T13:30:00Z)
with SQL functions.
I need to implement this using MySql preferrably, not using stored procedures.
Try this
To convert from GMT to local time:
select DATEADD(hour,DATEDIFF (hour, GETUTCDATE(), GETDATE()),MyGmtDateTime) as LocalDateTime
To convert from local time to GMT:
select DATEADD(hour,DATEDIFF (hour, GETDATE(), GETUTCDATE()),MyLocalDateTime) as GmtDateTime
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