I have taken over a system that sends messages. The send date for the message is a TIMESTAMP(14)
in MySQL. Messages can be scheduled to be sent in the future.
The system is based in the UK, where the timezones are either GMT or BST (GMT+1), depending on the time of the year.
In the existing code, the system sets the current timezone in MySQL using SET time_zone
. Right now, the timezone is BST and as a result, when querying sent dates from, say January when the timezone was GMT, the results are shown as one hour off, however the dates for messages sent in April appear correctly.
If I remove the SET time_zone
command, both dates appear correctly, however I believe that if (during BST) they schedule a message to be sent in November (which will be GMT again), then the messages will end up being sent one hour early, but I am not sure how to test and/or confirm this (other than by waiting until the timezones change).
How do I best cope with both situations, getting the (display) dates and setting the (send) dates correct for past, current and future messages?