kenw232 Posted September 8, 2016 Share Posted September 8, 2016 I'm running PHP 5.6. I set my web sites time zone with: date_default_timezone_set('America/Toronto'); This works fine and my site says the proper EST time with the date() command. I then check if daylight savings time is on with: echo date('I'); And it says "1" which means it is on. I need it off. I need to set my web site to EST with no daylight savings time. I do not have access to my php.ini. It has to be done via code. How can I do that? Does anyone know? Quote Link to comment https://forums.phpfreaks.com/topic/302105-disable-daylight-savings-time-from-php/ Share on other sites More sharing options...
Psycho Posted September 8, 2016 Share Posted September 8, 2016 (edited) I think you misunderstand what date('I') is. It does not state whether daylight savings time is "turned on" or not on the server. It returns whether the timestamp passed to the date() function is within the the dates for daylight savings (When no timestamp is passed it uses the current timestamp). This year, daylight savings in US/Canada goes from March 13, 2016 to Nov 6, 2016. Any timestamp passed to date() within those two dates will return true for the "I" parameter for those timezones where it applies. You cannot "turn that off" any more than you can turn off Christmas from being on Dec. 25th. What are you, specifically, trying to accomplish and/or what problem are you experiencing that the daylight savings is causing? Edited September 8, 2016 by Psycho Quote Link to comment https://forums.phpfreaks.com/topic/302105-disable-daylight-savings-time-from-php/#findComment-1537176 Share on other sites More sharing options...
Jacques1 Posted September 8, 2016 Share Posted September 8, 2016 Um, what? You're saying you get the correct time with EDT (UTC−04:00). Then you're saying you actually want EST (UTC−05:00). So which is it? Quote Link to comment https://forums.phpfreaks.com/topic/302105-disable-daylight-savings-time-from-php/#findComment-1537177 Share on other sites More sharing options...
requinix Posted September 8, 2016 Share Posted September 8, 2016 Sounds like OP is using "EST" as a layman's term. So This works fine and my site says the proper EDT time with the date() command. I need it off. I need to set my web site to the same time that EST would show but all year long. Quote Link to comment https://forums.phpfreaks.com/topic/302105-disable-daylight-savings-time-from-php/#findComment-1537179 Share on other sites More sharing options...
Jacques1 Posted September 8, 2016 Share Posted September 8, 2016 Possibly. It's just odd that somebody would complain specifically about the DST bit rather than the time being off. Anyway, maybe the OP can clarify this. Quote Link to comment https://forums.phpfreaks.com/topic/302105-disable-daylight-savings-time-from-php/#findComment-1537181 Share on other sites More sharing options...
Psycho Posted September 8, 2016 Share Posted September 8, 2016 Sounds like OP is using "EST" as a layman's term. So That's my belief as well. EST and EDT are both used to show the current, "true" time for people in that timezone. The S vs D is used to identify if that time is during the daylight savings period or not. It really doesn't have much use to people in that timezone because they don't have to translate the time. It is necessary when communicating time to other people in different timezones so they can convert correctly. Many regions/countries do not use DST, so if a meeting is scheduled for 5:00PM, the EST vs EDT is very important to participants in India (for example) which does not use daylight savings time. For them, the meeting could be at 2:30AM (if 5PM EDT) or 3:30AM (if 5PM EST). If the audience is all in the same timezone (or at least North America) it is acceptable to leave out that identifier and just use 5:00 ET. Quote Link to comment https://forums.phpfreaks.com/topic/302105-disable-daylight-savings-time-from-php/#findComment-1537183 Share on other sites More sharing options...
kenw232 Posted September 8, 2016 Author Share Posted September 8, 2016 Yes, I'm saying EST simple as in new york time. Now when DST comes around on Nov 6, 2016 I do not want the time turned back 1 hour and therefore the time reported by the PHP date() command on this specific web site to stay the same. possible? Quote Link to comment https://forums.phpfreaks.com/topic/302105-disable-daylight-savings-time-from-php/#findComment-1537188 Share on other sites More sharing options...
Jacques1 Posted September 8, 2016 Share Posted September 8, 2016 You are in daylight savings time right now, so your request doesn't make much sense in terms of how the real world works. But if you want to invent your own personal timezone, that's of course technically possible: <?php date_default_timezone_set('Etc/GMT+4'); var_dump(date('H:i:s')); Quote Link to comment https://forums.phpfreaks.com/topic/302105-disable-daylight-savings-time-from-php/#findComment-1537192 Share on other sites More sharing options...
requinix Posted September 9, 2016 Share Posted September 9, 2016 I need it off. I need to set my web site to EST with no daylight savings time. Now when DST comes around on Nov 6, 2016 I do not want the time turned back 1 hour Which is it? Daylight savings or no daylight savings? Quote Link to comment https://forums.phpfreaks.com/topic/302105-disable-daylight-savings-time-from-php/#findComment-1537205 Share on other sites More sharing options...
ginerjm Posted September 9, 2016 Share Posted September 9, 2016 (edited) It makes no sense to use a time that nobody else is using, unless this is for Indiana, Arizona, Saskatchewan(?) or parts of the Caribbean. Edited September 9, 2016 by ginerjm Quote Link to comment https://forums.phpfreaks.com/topic/302105-disable-daylight-savings-time-from-php/#findComment-1537234 Share on other sites More sharing options...
requinix Posted September 9, 2016 Share Posted September 9, 2016 It makes no sense to use a time that nobody else is using, unless this is for Indiana, Arizona, Saskatchewan(?) or parts of the Caribbean.My special powers tell me that OP is in the regular ol' EST/EDT region in Canada, and where America/Toronto is the correct timezone identifier. Quote Link to comment https://forums.phpfreaks.com/topic/302105-disable-daylight-savings-time-from-php/#findComment-1537235 Share on other sites More sharing options...
ginerjm Posted September 9, 2016 Share Posted September 9, 2016 My point exactly. The OP has not given us a clue as to why he so urgently seeks this knowledge. Quote Link to comment https://forums.phpfreaks.com/topic/302105-disable-daylight-savings-time-from-php/#findComment-1537236 Share on other sites More sharing options...
kenw232 Posted September 10, 2016 Author Share Posted September 10, 2016 If I set a custom timezone with date_default_timezone_set('Etc/GMT+4'); will the time change by 1 hour on Nov 6, 2016 when Daylight savings ends or stay the same? Quote Link to comment https://forums.phpfreaks.com/topic/302105-disable-daylight-savings-time-from-php/#findComment-1537262 Share on other sites More sharing options...
Jacques1 Posted September 10, 2016 Share Posted September 10, 2016 The real question is: Why are you so obsessed with dayling savings time? What's the actual problem you're trying to solve? Why can't your application handle DST? This whole discussion is just bizarre. Quote Link to comment https://forums.phpfreaks.com/topic/302105-disable-daylight-savings-time-from-php/#findComment-1537264 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.