Datestamps are inserted with wrong value (about -4 hours)

Sensoz - October 16, 2008 - 20:27
Project:Date
Version:6.x-2.0-rc4
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

SUMMARY:
When Datestamp values are inserted in the DB, it's not the same value as the input.

DETAILS:
I've added a Datestamp field to my story nodes. I'm accepting dates in this format: YYYY-MM-DD for every story.
If I input "2008/10/16", it displays this date exactly - no problem.
But in the database, in the content_type_story table, I get a UNIX timestamp value of 1224115200. If I convert that back to a normal date, I get the wrong date:
date("Y-m-d H:i:s", 1224115200);
returns: 2008-10-15 20:00:00

Which breaks my Calendar views, as all nodes appear on the previous day. I've set my site to UTC or EDT, same problem.

SOLUTION?
At this point, I don't really care how this can be fixed. Unless there's a settings error on my site, I'd just like to know where in the code the data gets inserted into the DB - I will manually add ~4 hours to every date. I've looked through the code but I could not find it.

Does it have something to do with the timezone or local time on the server? Is it a PHP thing, a Linux thing, a CCK thing or a MySQL thing? As I said, I'm just looking for a quick hack to artificially increment all timestamps by 4 hours.

#1

Sensoz - October 16, 2008 - 21:02

Hmm strangely, about 30 minutes later it seems to work correctly. The only thing I've change is set my site to UTC instead of EDT.

But still, it stupid that the timezone should affect a YYYY-MM-DD date since I don't care about the hour.

#2

alanburke - October 20, 2008 - 11:29
Project:Content Construction Kit (CCK)» Date
Version:6.x-2.0-rc10» 6.x-2.0-rc4
Component:General» Code
Status:active» fixed

Updated issue:
Date module issue, fixed.

#3

Anonymous (not verified) - November 3, 2008 - 11:41
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.