PHP Strange Timezone problem

On my system Timezone is Europe/Berlin in php.ini

//Block 1
$z = \'2009-10-25\';
$a = strtotime($z);
$b = date(\'r\',$a); //Format date from int time stamp to string
echo $b;
//value of $b will be Sun, 25 Oct 2009 00:00:00 +0200

//Block 2
$z = \'2009-10-26\';
$a = strtotime($z);
$b = date(\'r\',$a); //Format date from int time stamp to string
echo $b;
//value of $b will be Mon, 26 Oct 2009 00:00:00 +0100

1. When date is 25th Oct timezone is +2
2. When date is 26th Oct timezone is +1

You can see the difference in timezone caused by strtotime.
Assuming from 26th Oct, winter considered to be start & DST will be applied
in central Europe.

Now is is confirmed that, problem is caused by timezone setting change or DST.

If I keep timezone to UTC, then I can not see this problem. To overcome this issue I set timezone to UTC in my function. This behaviour seriously affects my complex program which calcultes hours.

Please let me know if you have any DST related official information. I mean when it will apply on which date.

Clock changes in Berlin

Advertisements

2 thoughts on “PHP Strange Timezone problem

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s