time() and daylight saving time

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tores
Forum Contributor
Posts: 120
Joined: Fri Jun 18, 2004 3:04 am

time() and daylight saving time

Post by tores »

Hi,

Does time() follow daylight saving time?

If no: Will I have to add one hour to the time returned by time() during daylight saving time?
If yes: Will time() state that time goes backwards one hour when going from daylight saving time to standard time?

regards tores
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

yes.. and no :)

The time returned is based on the server's settings. If it is set to follow daylight savings, it will. Otherwise, it won't. date() can tell you if you are in daylight savings mode or not.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

http://www.php.net/gmmktime[url] and [u ... net/gmdate can come in very handy. This way you can always calculate the required offset yourself... With the upcoming improvements of date and time management in php this will become easy ;) (untill then you'll have to add your own offsets and/or daylight saving settings)
Post Reply