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!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
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:Hope this helps!