[Résolu] types_render_field return date on day before what it's set in the post
This support ticket is created Il y a 7 années et 7 mois. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
ok the problem see to be a timezone problem... but let's start at the begining...
in the post, i select the date : sept 17 2016
so now when i retreive the date, i what it formated in french so
i use this function : $date_converted = types_render_field( "date_mam", array( "format" => "l j F Y", "output" => "html"));
and now the $date_converted = vendredi 16 septembre 2016
The date field is stored as a timestamp, so the rendering value depends on the timezone you have set or rather server is in.
The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT) . That means that the timestamp is fixed based on a fixed timezone. But what a timestamp means on a given timezone changes, and that is what gets output.
For example:
The timestamp on Spain refers to a number of seconds from Jan 1 1970 00:00 UTC, and that same value, when you move to Australia, gives a different moment of the day, even a different day.
Also, it does not depend so much on what time you think you are in, but what time/timezone the server is setup.
So, please check both your server timezone setup as you said it works when you remove the timezone settings that means server is setup into different timezone.