Function todate() different times

Hi! Does anyone know how can I fixed the next situation?

I want to get the date of a datetime using the function todate() but if the datetime is after 9PM (Chile Time), the result for the function is not the real date but the next day and this should only happens when the time is past 12 AM.

  Discussion posts and replies are publicly visible