I'm building an application that uses data extracted from another system. That system does not store dates with time data, but I need to use the MySQL datetime data type. This has the effect of giving all dates a time of 00:00:00, or midnight. When I create a View, the correct date is displayed in the table I made, but when I filter on a date, my timezone offset is applied and the wrong dates rows are listed in the table.
To complicate things, I have a number of other datetime fields using the Date API within my app and which will properly be converted to UTC upon storage. So these fields need to have timezone offsets applied both for viewing and filtering, but the others don't.
What are my options? My first guess is to modify the Views handler "date_api_filter_handler" and add an option of "Don't convert for timezone", but I'm not sure where I would then adjust the SQL that is sent to Views to make this happen. HELP!
Comments
Comment #1
karens commentedHow are you storing the data in Drupal? Is it in date fields or in custom fields? If date fields, you can set them up to not use timezones and the Views handling will not try to convert them.
Comment #2
rconstantine commentedI'm using mysql datetime fields. I ended up changing all of the scripts on the sql server side to adjust the times i'm importing to UTC time. Now everything is converting just fine. I didn't really see any other way. You mention views won't try converting dates/times, but I'm not sure how that would be. Doesn't it expect all dates to be UTC? And if my site is something other than UTC, don't the times get changed when displayed?
Comment #3
arlinsandbulte commentedHi,
I am just indiscriminately closing all support requests with no activity for more than 1 year.
If you consider this to still be a valid issue / support request, feel free to re-open.
BUT,
if you are re-opening this issue, please provide specific details on how this issue can move forward.
Thanks.