I've added a date field to a content type.

Now creating content, you set the date and time. (ie: 14:00)

Upon save or preview the displayed time is one hour behind (ie: 13:00).

The edit section shows the time the time now one hour behind what was originally entered.

If you do any further saves, the time will fall another hour behind.

I believe it could be an issue with timezones and British summer time, but I can't find any options to fix this.

Any ideas?

Thanks.

Comments

daniela basualdo’s picture

did you solve the problem? i've got the same one...no idea how to fix!

hm2k’s picture

No fix yet, however since the hour went back after British Summer Time (BST) to GMT the issue appears to have gone away.

Any ideas?

daniela basualdo’s picture

In my case I solved the problem. Database Timezone is UTC and Webserver Timezone is CET. Drupal does add automatically the time-difference from +1 hour in winter or +2 hours in summer.

As I selected the date value directly from the database I had 1 hours less, logically. So i had to transform it first to a unix timestamp (because I used a datetime filed) and then i formatted the date with format_date(). You can find here the example that fixed my problem:

http://www.dominiquedecooman.com/blog/format-dates-drupal-way-use-core-f...

If you print out a date value from a node or view the transformation has already been done from drupal.

karens’s picture

Status: Active » Fixed

The value in the database is stored in UTC. If you try to print it without transforming it back to your local timezone this is what you will see. There is no bug in the code here.

Status: Fixed » Closed (fixed)
Issue tags: -date, -time, -hour

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

aadesh.verma’s picture

Issue summary: View changes
StatusFileSize
new12.96 KB

Hi,

i have also getting this issue & found this is related to library file (libraries/datetimepicker/build/jquery.datetimepicker.full.js). This problem occur when date is in 12 hour format. On blur event, its parse the date where its calculate the hours again & make 1 hour behind it. See the calculation of it.

y.hour=s+f-1 (where s is hour value, f = (0 if time in am & 12 if time in pm)

We have removed the -1 from this calculation & its solve the problem. see attached my patch.

aadesh.verma’s picture

StatusFileSize
new12.98 KB

Hi,

Today, one of my friend @Aprajit have got 1 issue in my patch that is when we select 12AM / 12PM its not working. Its change the value from 12am to 12pm & vice versa.

I have fixed this issue with in updated patch (datetimepicker_fixes-2.patch ).