• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 124
  • Last Modified:

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.
0
aej1973
Asked:
aej1973
1 Solution
 
Chris StanyonCommented:
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 StanyonCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now