Information stored with INCORRECT TIMEZONE

Hi everyone, as per the title, I have a problem with the timezone.
I created a new custom module and when I create a new record, the creation time is incorrect.
In phpmyadmin there is a difference of a couple of hours, this also causes problems when importing data, the times are changed.
The SuiteCRM Timezone is correct, also in php.ini it is correct, I also set the timezone from code before saving, but it does not work.
I printed the times on the screen before saving and they were correct, after saving they are transformed.
Thinking that the problem was phpmyadmin (because the data_created etc. are incorrect), I ran inside it:

SELECT now()

and the time displayed is correct.
I no longer know what to check or change to solve the problem, does anyone have any ideas please? Thanks.

A couple of things you can check…

  1. See the timezone setting as shown in Admin / Diagnostics / phpinfo. This will confirm the effective setting in your web server. If it doesn’t match, that same information will guide you to the correct php.ini (there can be more than one).

  2. If your records are created in “on scheduler workflows”, that is not going through the web server, but through the CLI PHP. That’s a different php.ini, you can learn about this from the command-line:

php -i | grep timezone

php -i | grep php.ini

SuiteCRM always store dates in UTC

@scicali is right, I didn’t realize you were asking about how the value is in the database. In there, it’s always UTC and should be. Which is fine, as long as it shows correctly (according to user profile timezone) to each user when it is displayed.

Remember that a company can have users accessing the CRM from multiple timezones.

this is the problem, to make it work I had to set the SuiteCRM timezone to UTC, instead of setting it to my timezone because otherwise it is off by a couple of hours

What is your issue?

What timezone did you set in the php.ini file?

@rsp No, there is no “;”, I already changed it manually, setting it to “UTC”

Don’t conflate all of these things…

  • all dates in the DB are UTC regardless of any settings
  • timezone setting in web server php.ini is how the web app knows what time it is
  • timezone setting in CLI php.ini is how the scehduler parts of the app know what time it is
  • timezone setting in user profile controls how the data gets saved and displayed to that user