Hi,

I'm trying to migrate users from a custom built mysql database into Drupal 7.
In the users table in the source DB I have a date column, values are stored like: 2013-03-20.
When I migrate the users, the date field on the user profile in Drupal is one day off. So 2013-03-20 in the source DB changed to 2013-03-19T22:00:00 in the Drupal DB.
I use a Date (ISO format) field on the user profile.
Does anybody know what's going on exactly? Any help is much appreciated.

Comments

aleksijohansson’s picture

Category: support » bug

I have exactly the same issue, but when migrating content with date field from D6 to D7.

2pha’s picture

Issue summary: View changes

I have stumbled upon this problem today. Must have something to do with the timezone. Did you come up with a solution?

2pha’s picture

Status: Active » Closed (works as designed)

Turns out it was because I had my site timezone set to 'Australia/Brisbane' but was not setting the timezone of the field when migrating. So I assume the migrate was setting the migrated date field to UTC and then the field was converting on output.
When setting the datefield timezone to the same as the site on migration, I got the expected results.

    $this->addFieldMapping('field_date', 'date');
    $this->addFieldMapping('field_date:timezone')
    ->defaultValue('Australia/Brisbane');

I am changing status to works as designed