PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
trying to figure out Date Timezones

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Date & Time
View previous topic :: View next topic  
Author Message
primeminister
Site Admin


Joined: 16 Apr 2006
Posts: 95
Location: Netherlands

PostPosted: Mon Sep 03, 2007 10:39 pm    Post subject: trying to figure out Date Timezones Reply with quote

Hi,

I'm a bit lost in the whole converting timezone issues in Date.

What I'm trying to do is:
[list=]
Get the current date.
Convert to UTC
[/list]
But the current date is based in the server timezone. So I set the timezone manually with setTZById() and then the toUTC.
But I get wrong numbers everywhere and it has something to do with daylight saving time.
Code:

$oNow = new Date();
$tz = exec('date "+%Z"');
$oNow->setTZById($tz);
$oNow->toUTC();


My $tz is 'CEST' which means CET in daylight saving time.

Is it converted automatically?
Or do I have to subtract the offset myself?
And is the inDaylightTime() function working?

Thnx!
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Date & Time All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement