I am developing a plugin and at some point I submit a time value to mariadbb 10.1 in a time field. Maria DB timezone is set to 'Europe/Athens' both for the global and the session time_zone varialbe.
Although in my global configuration I have set the website Time Zone to "Europe/Athens" my value is inserted as UTC time, 3 hours earlier.
The output of the date_default_timezone_get() is 'UTC' so the above faulty behavior is expected. I have not change somewhere else the timezone so I am stuck.
I don't want to execute date_default_timezone_set() everywhere. I would prefer to use Joomla global set variable.
Any help is appreciated.
In case someone has the same problem that 's how I solved it.
I was filling values with date('Y-m-d H:i:s'). By changing to
$d = new DateTime('now', $timeZone)
solved my problem. Where $timeZone is a DateTimeZone. Thus my dates had datetime zone information.
Another point was at calendar fields where I had to set filter="none" instead of the "utc" which is the default.