I'm developing on my own machine (PHP 5.2.5), deploying to a remote machine (PHP 5.1.6). So, the remote environment is using the Date PHP4 wrappers (I have Date PHP4 enabled in my environment, but of course the real 5.2 functions are being used). Both Drupal sites are configured to US/Eastern, and the machine timezones are also EDT. The problem - printing date_now() shows the local time on my machine, but GMT on the remote site. Specifically, this code fragment:

  drupal_set_message('date_now: '.dpr(date_now(),TRUE));
  $now = date_format(date_now(), DATE_FORMAT_ISO);
  drupal_set_message("cron: now=$now");
  drupal_set_message("RFC version ".date_format(date_now(), DATE_RFC3339));
  drupal_set_message("time=".time());

produces this with PHP 5.2.5:

# date_now:

DateTime Object
(
)

# cron: now=2008-06-12T11:43:06
# RFC version 2008-06-12T11:43:06-04:00
# time=1213285386

and this with PHP 5.1.6:

# ate_now:

stdClass Object
(
[value] => 2008-06-12 15:43:11
[timestamp] => 1213285391
[timezone] => US/Eastern
)

# cron: now=2008-06-12T15:43:11
# RFC version 2008-06-12T15:43:11-04:00
# time=1213285391

Comments

karens’s picture

Status: Active » Fixed

This was a good catch and useful information. I think I've got this working correctly now. It may also be the cause of a couple other PHP4 issues. Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)

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