DATETIME_FORMAT() off by a day


Hi it seems like I’m getting inconsistent output from the DATETIME_FORMAT()
I have a field with the date type called “res” and it specifies the time as well.

If I refer to that field with the DATETIME_FORMAT() function and try to express the date in a certain format, like MM/DD, the date actually seems to be off by a day when the time is after a certain time. so for example, if the actual data referred to is 01/10 7:00PM, then what’s shown with DATETIME_FORMAT(res, “MM/DD”) is 01/11, which is a day ahead.

The cut-off time seems to be at 4PM, so if the data is 01/10 3:59PM, then the correct expression (01/10) is shown.
Is this a bug? I’ve shared my example below

I need help with this issue which might be a bug

Same issue here. Using table to record sent emails. The date of the email is advanced a day when I run DATETIME_FORMAT on the data.


You need to use set_timezone function to get what you want.