Skip to main content

DATETIME_FORMAT() off by a day

  • January 3, 2017
  • 2 replies
  • 34 views

Forum|alt.badge.img+6

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

2 replies

Forum|alt.badge.img
  • New Participant
  • May 8, 2017

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.


Forum|alt.badge.img+3
  • Participating Frequently
  • May 8, 2017

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.