I’m having problems with the DateTime fields in my models.
In my models, i want the datetime fields, stored in mysql in UTC.
The system that is running the atk and my project is in UTC+3.
I want the Grids and cruds and tables showing this field in UTC+3
Right now, i’m checking the values in DB, and the field in DB shows 19:37:00
The grid is also showing this field as 19:37:00.
When i want to update this field through my atk project, i get the datetime from date(). Which gives the time in current timezone. When i set this in model, and save it, it converts it into UTC from current time zone. So DB values are in UTC. Good.
But when it loads it up, the Persistance_SQL _typecastLoadField function sets the datetime class timezone as date_default_timezone_get() which is the current timezone.
Then at somepoint, UI’s _typecastSaveField is called and this sets the timezone back to UTC (as it is default for ATK) and the grid shows the values in UTC.
My question is:
What is the correct way of making table components show the value in system’s current timezone, while storing those in UTC in DB.