Why does the DATE() function return the next date after 6:00 PM?

I have a dataset with a Date and Time stamp field.  When I convert it to a date field using DATE(`date_field`) I am finding some unexpected results.




The only way that I was able to get the intended results was to subtract 6 hours from the timestamp first:

Is this an intended function of the DATE() function, or am I doing something wrong?

Best Answers

  • Godiepi
    Godiepi 🟣
    Accepted Answer

    Have you tried using the Convert_TZ() fundtion  as a second argument ?

    here it is an simple example of how to use it



    this give us the number of days from current date/time

  • Godiepi
    Godiepi 🟣
    Accepted Answer

    The CONVERT_TZ function automatically accounts for daylight savings when using long time zone names


    for example:

    CONVERT_TZ(`Date`, '+00:00', '+10:00')

  • cwolman
    cwolman 🟠
    Accepted Answer

    Try this one out.

    convert_tz(`Date and time of Last Change`,'utc','us/central')


  • It does the same thing on my flows so we have to adjust for UTC time since we are in EST time,  always substracting 4 or 5 hours depending of daily savings time to prevent that issue

  • How do you determine the number of hours to subtract though?  I would like to prevent the need to change my dataflow every 6 months or so

  • I feel like this runs into the same issues.  At some point you would need to change from 




    I can't find a way to automate the switch, given that the actual date changes each year

  • I thought we had a solution here, but I'm not able to get the long timezone name to work:tz.png


  • Thank you @cwolman  and @Godiepi 


    I'm not sure how many answers I can accept as a solution, but I've got this conversion working now.  

    ty sman.png


  • @ST_-Superman-_  its got to take more than one to be able to help the man of steel ?  (Superman theme song playing in the backgorund)


    @DaniBoy  should take @cwolman  and me up a Belt in the Dojo for doing this LOL !


    Have a good day guys

  • DaniBoy



    This is an AWESOME example of community collaboration!

    Well done @Godiepi @cwolman  and @ST_-Superman-_ 


    Enjoy your new belts! You guys are all Super!