Setting time in php.ini file

Hello, is it possible to set up the time in my php.ini file in such a way that that it can automatically switch between EST and EDT ( when the time changes to daylight savings time) ? Please let me know.

Thank you.
aej1973Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris StanyonWebDevCommented:
Set the timezone in the ini file to one that supports Daylight Savings and you should be good to go. The default is usually UTC (which isn't aware of daylight savings). The setting to look for is date.timezone. It'll look something like this:

date.timezone = UTC

Check here for a list of supported timezones: http://php.net/manual/en/timezones.php
0
aej1973Author Commented:
I will be able to set up EST or EDT but how can I set it up in such a way that the php.ini file will chose either EST or EDT depending on the date.

Thanks
0
Chris StanyonWebDevCommented:
As long as you set the timezone to one which recognizes daylight savings, the system should know what date to switch it automatically.
0
Dave BaldwinFixer of ProblemsCommented:
Chris is correct.  DST is a matter of law which is part of why there are so many different time zones.  You would think that Mountain Standard time would apply to all the states in that region... except that Arizona does not recognize DST at all.  That's why they have their own time zone.
0
Ray PaseurCommented:
PHP date/time handling is amazingly easy.  PHP has done all of the work for you.  This article explains how it works.  And while there are some more recent OOP additions to the PHP libraries, the principles and the code in the article still work correctly.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.