as per your documentation

$date = date_create('2007-03-11 02:00:00', timezone_open('America/Chicago'));
$chicago_time = date_format('Y-m-d H:i', $date);

i get

"At in Chicago, the timezone offset in seconds was -18000"

Comments

dgtlmoon’s picture

taken from README.txt


Example, the following will create a date for the local value in one
timezone, adjust it to a different timezone, then return the offset in seconds
in the new timezone for the input date; The offset will be adjusted for both
the timezone difference and daylight savings time, if necessary:

$date = date_create('2007-03-11 02:00:00', timezone_open('America/Chicago'));
$chicago_time = date_format('Y-m-d H:i', $date);

print 'At '. $chicago_time .' in Chicago, the timezone offset in seconds
  was '. date_offset_get($date);

date_timezone_set($date, timezone_open('Europe/Berlin');
$berlin_time = date_format($date, 'Y-m-d H:i');

print 'It was '. $berlin_time .' in Berlin when it
  was '. $chicago_time .' in Chicago.';
print 'At that time in Berlin, the timezone offset in seconds was
  '. date_offset_get($date);
karens’s picture

Status: Active » Fixed

Mistake in the text.

date_format('Y-m-d H:i', $date);

should be

date_format($date, 'Y-m-d H:i');

I'll fix it :(

dgtlmoon’s picture

no problems

also in the date_popup/README.txt


==================================================================================
Example:
==================================================================================

$form['date'] = array(
  '#type' => 'date_popup',
  '#default_value' => '2007-01-01 10:30:00,
  '#date_type' => DATE_DATETIME,
  '#date_timezone' => date_default_timezone_name(),
  '#date_format' => 'm/d/Y - H:i',
  '#date_increment' => 1,
  '#date_year_range' => '-3:+3',
);

theres a ' missing on #default_value

Status: Fixed » Closed (fixed)

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