NOT CORRECT DATE WITH TIMEZONE

Created on 23 May 2022, over 2 years ago
Updated 27 October 2023, 11 months ago

Problem/Motivation

When you use it to format date, the format date mysql/mariaDB function not get the timezone, so, the dates can be wrong for different timezone users.

Proposed resolution

Just change the SQL query

DATE_FORMAT(FROM_UNIXTIME( field_timestamps ), '%Y/%m')

to

DATE_FORMAT( CONVERT_TZ ( FROM_UNIXTIME( field_timestamps ), '+00:00' , '+02:00' ), '%Y/%m')

to convert the timezone. I use +00:00 and +02:00 as an example ... but you can get the configuration timezone by the views option settings "timezone". I think is not complex to do.

πŸ› Bug report
Status

Needs work

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand thomasmurphy

    I also have this problem. I am aggregating a views_date_format_sql field, and the results where dependent upon UTC rather than the supplied default time zone.

    I tried the patch from #5 but the view I was having trouble with ended up with no results at all with the patch applied, so it still needs work.

  • πŸ‡ΊπŸ‡ΈUnited States whthat

    This needs test written to pass, but patch #5 is working for timezone offsets. Great Stuff, a true missing element of great time based reporting with views!

Production build 0.71.5 2024