similar as http://drupal.org/node/156171

When I did view using date cck field, (time is shown "time ago" e.g.)
all date are shown + 2 hours
My date settings is Europe/Prague
Using latest Date and Calendar module, latest CCK stable version 1.9.

I think 2 - 3 weeks ago it works fine and dates was shown correctly.

My views export:

 $view = new stdClass();
  $view->name = 'a_pokus';
  $view->description = 'just for trying date module';
  $view->access = array (
);
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = 'pokus';
  $view->page_header = '';
  $view->page_header_format = '3';
  $view->page_footer = '';
  $view->page_footer_format = '3';
  $view->page_empty = '';
  $view->page_empty_format = '3';
  $view->page_type = 'list';
  $view->url = 'pokus/a_pokus';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '20';
  $view->sort = array (
    array (
      'tablename' => 'node_data_field_odkedy',
      'field' => 'field_odkedy_value',
      'sortorder' => 'DESC',
      'options' => '',
    ),
  );
  $view->argument = array (
  );
  $view->field = array (
    array (
      'tablename' => 'node',
      'field' => 'title',
      'label' => '',
      'handler' => 'views_handler_field_nodelink',
      'options' => 'link',
    ),
    array (
      'tablename' => 'node_data_field_odkedy',
      'field' => 'field_odkedy_value',
      'label' => '',
      'handler' => 'content_views_field_handler_group',
      'options' => 'format_interval',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array (
      'tablename' => 'node_data_field_odkedy',
      'field' => 'field_odkedy_value_to|day',
      'operator' => '>',
      'options' => 'now',
      'value' => '',
    ),
    array (
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => 'vseobecna_akcia',
),
    ),
  );
  $view->exposed_filter = array (
  );
  $view->requires = array(node_data_field_odkedy, node);
  $views[$view->name] = $view;

My CCK date field export:

$content[type]  = array (
  'name' => 'Akcia - Všeobecná (nie naša) akcia',
  'type' => 'vseobecna_akcia',
  'description' => 'vseobecna akcia',
  'title_label' => 'Nadpis',
  'body_label' => 'Text',
  'min_word_count' => '25',
  'help' => 'Všeobecná akcia nie je organizovaná členmi/členkami zo SomvPrahe.sk a nezobrazuje sa na titulke, ale v bloku s bliziacimi sa vseobecnymi akciami a v kalendari vseobecnych akcii.
<br />
Typický príklad všeobecných akcií sú koncerty známych kapiel/spevákov/speváčiek, skupín, festivaly, výstavy, akcie rôznych kultúrnych spolkov, alebo iná akcia, na ktorú chceš ostatných upozorniť.
<br />
Keď vkladáš akciu, nevkladaj len odkaz na nejaké stránky, ale vlož aj text o akcii, nech návštevnící vidia bez klikania aspoň základné info o čom daná akcia je.',
  'node_options' => 
  array (
    'status' => true,
    'promote' => true,
    'sticky' => false,
    'revision' => false,
  ),
  'nodefamily_max' => '0',
  'nodeprofile' => 0,
  'comment' => '2',
  'upload' => '1',
  'excerpt' => '1',
  'excerpt_wt' => '4',
  'notifications_node_ui' => 
  array (
    'links' => true,
    'form' => false,
    'comment' => false,
    'block' => false,
  ),
  'og_content_type_usage' => 'group_post_standard_mail',
  'phpfreechat_nodeapi' => 'never',
  'phpfreechat_nodeapi_custom' => 0,
  'phpfreechat_nodeapi_title' => '',
  'phpfreechat_nodeapi_channels' => '',
  'privatemsg_link' => 
  array (
    'node' => true,
    'teaser' => true,
    'comment' => true,
  ),
  'signup_node_default_state' => 'enabled_on',
  'signup_form_date' => '',
  'old_type' => 'vseobecna_akcia',
  'orig_type' => '',
  'module' => 'node',
  'custom' => '1',
  'modified' => '1',
  'locked' => '0',
  'fivestar' => 0,
  'fivestar_stars' => 5,
  'fivestar_labels_enable' => 1,
  'fivestar_label_0' => 'Cancel rating',
  'fivestar_label_1' => 'Poor',
  'fivestar_label_2' => 'Okay',
  'fivestar_label_3' => 'Good',
  'fivestar_label_4' => 'Great',
  'fivestar_label_5' => 'Awesome',
  'fivestar_label_6' => 'Give it @star/@count',
  'fivestar_label_7' => 'Give it @star/@count',
  'fivestar_label_8' => 'Give it @star/@count',
  'fivestar_label_9' => 'Give it @star/@count',
  'fivestar_label_10' => 'Give it @star/@count',
  'fivestar_style' => 'average',
  'fivestar_text' => 'dual',
  'fivestar_title' => 1,
  'fivestar_feedback' => 1,
  'fivestar_unvote' => 0,
  'fivestar_position_teaser' => 'hidden',
  'fivestar_position' => 'below',
  'fivestar_comment' => 0,
  'old_og_content_type_usage' => 'group_post_standard_mail',
  'send_type' => 'vseobecna_akcia',
  'notifications_lite_vseobecna_akcia_fulltext' => '',
  'notifications_lite_vseobecna_akcia_linktext' => '',
  'notifications_lite_vseobecna_akcia_subject' => '',
  'notifications_lite_vseobecna_akcia_message' => '',
  'notifications_lite_vseobecna_akcia_template' => '%message
%body
',
  'notifications_lite_vseobecna_akcia' => 0,
  'notifications_lite_vseobecna_akcia_pernode' => '',
  'send_vseobecna_akcia_fulltext' => '',
  'send_vseobecna_akcia_linktext' => 'Pošli kamarátom',
  'send_vseobecna_akcia_subject' => 'Akcia - Všeobecná (nie naša) akcia from SOM v PRAHE.sk',
  'send_vseobecna_akcia_message' => '',
  'send_vseobecna_akcia_template' => '%message
%body
',
  'send_vseobecna_akcia' => 1,
  'send_vseobecna_akcia_pernode' => '',
  'ant' => 0,
  'ant_pattern' => '',
  'ant_php' => 0,
  'feedapi' => 
  array (
    'enabled' => false,
    'refresh_on_create' => 0,
    'update_existing' => '1',
    'skip' => 0,
    'items_delete' => '0',
    'parsers' => 
    array (
      'parser_common_syndication' => 
      array (
        'enabled' => '1',
        'weight' => '0',
      ),
    ),
    'processors' => 
    array (
      'feedapi_aggregator' => 
      array (
        'enabled' => '',
        'weight' => '0',
        'block' => '3',
        'categories' => 
        array (
          1 => false,
          2 => false,
        ),
      ),
    ),
  ),
  'formtweaker' => 
  array (
    'taxonomy' => 
    array (
      'style' => 'select',
      68 => 
      array (
        'style' => 'default',
      ),
    ),
  ),
);
$content[fields]  = array (
  0 => 
  array (
    'widget_type' => 'date_select',
    'label' => 'Dátum akcie',
    'weight' => '-2',
    'default_value' => 'now',
    'default_value_code' => '',
    'default_value2' => 'now',
    'default_value_code2' => '',
    'input_format' => 'j M Y - H:i:s',
    'input_format_custom' => '',
    'year_range' => '-0:+1',
    'increment' => '5',
    'advanced' => 
    array (
      'label_position' => 'none',
      'text_parts' => 
      array (
        'year' => 0,
        'month' => 0,
        'day' => 0,
        'hour' => 0,
        'minute' => 0,
        'second' => 0,
      ),
    ),
    'description' => '',
    'group' => false,
    'required' => 1,
    'multiple' => '0',
    'repeat' => 0,
    'todate' => 'optional',
    'granularity' => 
    array (
      'year' => 'year',
      'month' => 'month',
      'day' => 'day',
      'hour' => 'hour',
      'minute' => 'minute',
    ),
    'output_format_date' => 'j. F Y - G:i',
    'output_format_custom' => '',
    'output_format_date_long' => 'l, j F, Y - H:i',
    'output_format_custom_long' => '',
    'output_format_date_medium' => 'j F, Y - H:i',
    'output_format_custom_medium' => '',
    'output_format_date_short' => 'd/m/Y - H:i',
    'output_format_custom_short' => '',
    'tz_handling' => 'none',
    'timezone_db' => 'UTC',
    'field_name' => 'field_odkedy',
    'field_type' => 'date',
    'module' => 'date',
    'label_position' => 'none',
    'text_parts' => 
    array (
    ),
    'display_settings' => 
    array (
      'label' => 
      array (
        'format' => 'above',
      ),
      'teaser' => 
      array (
        'format' => 'default',
      ),
      'full' => 
      array (
        'format' => 'default',
      ),
    ),
  ),
);

Comments

igorik’s picture

I disable a lot of modules I had so now the export of my cck date field can be more clear and simply

$content[type]  = array (
  'name' => 'Akcia - Všeobecná (nie naša) akcia',
  'type' => 'vseobecna_akcia',
  'description' => 'vseobecna akcia',
  'title_label' => 'Nadpis',
  'body_label' => 'Text',
  'min_word_count' => '25',
  'help' => 'Všeobecná akcia nie je organizovaná členmi/členkami zo SomvPrahe.sk a nezobrazuje sa na titulke, ale v bloku s bliziacimi sa vseobecnymi akciami a v kalendari vseobecnych akcii.
<br />
Typický príklad všeobecných akcií sú koncerty známych kapiel/spevákov/speváčiek, skupín, festivaly, výstavy, akcie rôznych kultúrnych spolkov, alebo iná akcia, na ktorú chceš ostatných upozorniť.
<br />
Keď vkladáš akciu, nevkladaj len odkaz na nejaké stránky, ale vlož aj text o akcii, nech návštevnící vidia bez klikania aspoň základné info o čom daná akcia je.',
  'node_options' => 
  array (
    'status' => true,
    'promote' => true,
    'sticky' => false,
    'revision' => false,
  ),
  'nodefamily_max' => '0',
  'nodeprofile' => 0,
  'comment' => '2',
  'upload' => '1',
  'old_type' => 'vseobecna_akcia',
  'orig_type' => '',
  'module' => 'node',
  'custom' => '1',
  'modified' => '1',
  'locked' => '0',
  'ant' => 0,
  'ant_pattern' => '',
  'ant_php' => 0,
);
$content[fields]  = array (
  0 => 
  array (
    'widget_type' => 'date_select',
    'label' => 'Dátum akcie',
    'weight' => '-2',
    'default_value' => 'now',
    'default_value_code' => '',
    'default_value2' => 'now',
    'default_value_code2' => '',
    'input_format' => 'j M Y - H:i:s',
    'input_format_custom' => '',
    'year_range' => '-0:+1',
    'increment' => '5',
    'advanced' => 
    array (
      'label_position' => 'none',
      'text_parts' => 
      array (
        'year' => 0,
        'month' => 0,
        'day' => 0,
        'hour' => 0,
        'minute' => 0,
        'second' => 0,
      ),
    ),
    'description' => '',
    'group' => false,
    'required' => 1,
    'multiple' => '0',
    'repeat' => 0,
    'todate' => 'optional',
    'granularity' => 
    array (
      'year' => 'year',
      'month' => 'month',
      'day' => 'day',
      'hour' => 'hour',
      'minute' => 'minute',
    ),
    'output_format_date' => 'j. F Y - G:i',
    'output_format_custom' => '',
    'output_format_date_long' => 'l, j F, Y - H:i',
    'output_format_custom_long' => '',
    'output_format_date_medium' => 'j F, Y - H:i',
    'output_format_custom_medium' => '',
    'output_format_date_short' => 'd/m/Y - H:i',
    'output_format_custom_short' => '',
    'tz_handling' => 'none',
    'timezone_db' => 'UTC',
    'field_name' => 'field_odkedy',
    'field_type' => 'date',
    'module' => 'date',
    'label_position' => 'none',
    'text_parts' => 
    array (
    ),
    'display_settings' => 
    array (
      'label' => 
      array (
        'format' => 'above',
      ),
      'teaser' => 
      array (
        'format' => 'default',
      ),
      'full' => 
      array (
        'format' => 'default',
      ),
    ),
  ),
);

roald’s picture

I have the same issue in v. 6. Mine is +1 hour offset when showing a cck-date as a field in a view. My standard timezone is Europe/Oslo, but even when changing time-zone the offset is the same.

roald’s picture

Hmmm... Seems I found why: The Time zone handling of the field in the actual content type was set to "No time zone conversion". Switched to "User's time zone" and things started to work as expected.

And BTW: Thanks to KarenS for excellent modules! I've been using the event module for quite some sites, but this flexibility is what I wanted all the time :-)

igorik’s picture

Hi

it doesn't works for me.

I have date settings: Europe/Prague (it is GMT + 1) and I don't allow change timezone to users.

I noticed that nothing happens in views if change timezone for CCK date field timezone on my node.

It changes date on node depend on timezone I select, but it is weird,
because if I change this CCK date field Timezone to User's Timezone, then the time on node is + 2 hours versus as it was with no timezone.
I don't know why because as I wrote, my users can't change their timezone settings so they could have to same timezone as the site has.

Igorik
http://www.somvprahe.sk

karens’s picture

Status: Active » Postponed (maintainer needs more info)

I assume the people having problems are using PHP versions less than PHP 5.2, that's usually where the problems are.

The most difficult thing to get working correctly is user-specific timezones in those older versions of PHP. You'll usually find that the site timezone will work fine, but user-specific timezones can go wrong in lots of places. In some setups, it may not be possible to get it working correctly. All these problems go away if you use PHP 5.2 or above, so if you have any way to move to a server that uses that, it will fix many things.

You also need to clarify exactly where the date is incorrect, since the problem can be different depending on where you see it. Is it right when you view the node? Is it right when you edit the node? Is the value displayed in the calendar field right (not the the popup, which is the node teaser, but the date you see in the calendar without the popup? Each of those is coming from a different place.

If the date is wrong when you view or edit the node, try editing it and setting it to the right date and saving it again, then see if the date shows up correctly. If that works, it could be that the stored date was wrong before because of old timezone problems that have since been fixed, and you should be OK once you fix the value in the database.

If that doesn't work, go to admin/settings/date_api and see what value is set there. There is a choice between a fast, but sometimes less accurate method and a slower but more accurate method, and if you are set to use the less accurate method you'll need to change that setting.

igorik’s picture

Hi Karen, some additional info from me:

-- System info --
PHP: 5.2.3-1ubuntu6.4
Unicode library : PHP Mbstring Extension
Web server: Apache
MySQL database: 5.0.45
Drupal 5.11 (was 5.10 before)

-- Date info --

1.)Date and time settings: (admin/settings/date-time)
Timezone: Europe/Prague
Option to change timezone: Disabled
Started day in week: Monday
Short format date: 12 Okt 2008 - 00:09 (Right time, same as it is on my clock in this moment)

2.) CCK date field on specified note type:
Date format: 12 Okt 2008 - 00:09:51 (right time, same as in date and time settings and as it is on my clock in this moment)
Default display
-Date Display: 12. Oktober 0:04 - (this IS NOT right time, right time had to be 0:09)
Timezone handling: no timezone conversion
Other cck date field settings are in cck date field export above

3.) example node with date and it's date in calendar:
Alicia Keys concert in Prague
http://www.somvprahe.sk/akcie/vseobecne/alicia-keys-prvy-krat-v-prahe
date in node: 14. Október 2008 20:00 - 22:00
Date in my calendar views (page, not popup - link: http://www.somvprahe.sk/kalendar/akcie/vseobecne)
for this node is: 20:00 - 22:00

Please let me know if I can help to you with some additional infos.
Thanks for your work, Karen

Igorik
http://www.somvprahe.sk

karens’s picture

While working on the integration with the Signup module we found and fixed a number of timezone issues, so I'm assuming that this is now working. If not, please confirm this is still a problem with the latest code.

igorik’s picture

Status: Postponed (maintainer needs more info) » Fixed

Hi Karen
Now it si working correctly (drupal 6, latest Date module). Good job, thanks.

Igorik
http://www.somvprahe.sk

Status: Fixed » Closed (fixed)

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