As I posted here http://drupal.org/node/70380#comment-851829 I was trying to show a non-standard field from a node referenced and I did, but I have a problem I can't solve.
When I use views_handler_field_dates() in my field inside the function I get "12/31/1969 - 7:33 p.m." as the date but If I define a new function views_handler_field_dates_iso and use it then I get "2008-05-10T00:00:00" as the date, If I apply a filter to this date I get an empty view, my guess is that is because of the T00:00:00.
I don't know if this is a problem related to views, cck or date. i tried using the solutions in http://drupal.org/node/147563 and http://drupal.org/node/119879 but those are a little bit different since I'm not using the event module.
So how can I solve this to get "05/10/2008" instead of "12/31/1969 - 7:33 p.m." or "2008-05-10T00:00:00"?
Thanks in advance
Luis
Comments
Comment #1
lelizondo commentedI've identified the problem.
First I changed the datatype from VARCHAR to DATE in the field_m_date_value column. This way the T00:00:00 disappeared.
But, when I use a filter I get this query:
In this case and with this query Views returns nothing. If I paste the query into a query browser I get an error:
Incorrect date value: '1211432400' for column "field_m_date_value' at row 1
if I change the query in the query browser to this:
Everything works the way it should.
So the problem is that when I use a filter and type '2008-05-22' views (or php) translates this to '1211432400' and somehow mysql can't display this correctly.
I see to possible solutions for this: the first one is to avoid views from converting '2008-05-22' into '1211432400' (how do I do this?).. The other one is to find out why mysql can't get the value 1211432400 as a correct date.
I must say that if I use a filter for the node's created date and views translates '2008-05-22' to 1211432400 everything works fine. I don't know why in one case it does works (node's created date) and it doesn't for the other one (field_m_date_value).
Any help?
Thanks
Luis
Comment #2
lelizondo commentedSolved. I erased the field field_m_date_value, this one was a date and created another one with the same name but this new one was Datestamp. Problem solved. I had a little issue with the date because it was being showed 1 day before the actual date but this was apparently a problem with my time zone (-6), i just changed this and everything is working great. I can use filters and i changed the date handler to views_handler_fields_dates instead of views_handler_fields_dates_iso.
Comment #3
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.