2

I have a content type with a Date CCK field that prints the correct date/time specified in nodes (using the correct timezone, format, etc.). I also created a view that uses this date field, but the time I am getting from the view date data is (+)4 hours off. The date information is being printed in a views template using the $row object (specifically, the raw array key inside of the date field array). This array provides the 'to' and 'from' dates (and time), the timezone, and all other relevant information, but the values are 4 hours off as I said above.

Is there something I need to do when printing these kinds of values in a view in order to get the correct time? I'm assuming the Date module does some sort of processing that the views data isn't getting. Any guidance would be great because I have no idea why this is happening.

2
  1. Double check that your site's timezone is accurate at: Site Configuration > Date & Time
  2. Double check that your user timezone is accurate in your profile. Perhaps turn off user timezones (on the same admin pages as above.)
  3. Confirm how timezones are handled on the specific CCK field. There are 5 options: Site's time zone, Date's time zone, User's time zone, UTC, and No time zone conversion.
  • I actually just ended up doing this: date('g:iA',strtotime($the_date_string) - 14400);. The Date module does something to the values once it pulls them from the database, but I'm not completely sure what. – Joe Apr 29 '11 at 12:26
  • As you probably know that solution is not the right one. Something I've also seen is that a server date can be set wrong, or in another timezone. If your site's timezone just takes the server timezone weirdness can happen. The above stuff I mentioned should allow you to correct any weirdness. I promise that the data module isn't just adding the 4 hours for no reason :) – doublejosh Apr 29 '11 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.