Hello everyone! I’m having some trouble changing the time zone on mysql server.
I have an App (Hosted here) which saves the datetime to my database, (I don’t explicity tell it the date and time, I just set the field on the db to current timestamp)
Whenever my App calls for the insertion, I get the wrong timezone (4 hours later than it is)
However when I manually send the SQL for insert (also not giving it any value) the time is right.
Here’s the config from the api.
"config": {
"default_time_zone": "America/Montevideo",
"interactive_timeout": 50400,
"max_allowed_packet": 67108864,
"sql_mode": "ANSI,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,STRICT_ALL_TABLES",
"sql_require_primary_key": **true**,
"wait_timeout": 50400,
"innodb_ft_min_token_size": 3,
"innodb_ft_server_stopword_table": "",
"innodb_print_all_deadlocks": **false**,
"innodb_rollback_on_timeout": **false**,
"slow_query_log": **false**,
"long_query_time": 10,
"backup_hour": 17,
"backup_minute": 43
}
Any ideas how to fix it? Thanks in advance
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hey @fea5b15c6f1a44a09199ee55be0a4e,
So you, basically have the proper config for your MySQL Managed Database.
As for your App, basically, as it has a different timezone, when the SQL insert query is called from there you get the Apps timezone.
This has been discussed here
https://www.digitalocean.com/community/questions/how-to-adjust-the-server-timezone-in-app-platform
You can set the timezone with an TZ environment variable, for example:
TZ='Africa/Lagos'
Hope this helps!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.