Solved

Setting Default Timezone - How?

Posted on 2014-03-01
2
321 Views
Last Modified: 2014-03-04
I'm working on a 1and1 server and I'm getting this message on one of my calendar pages:

Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /homepages/42/d514133230/htdocs/adm/calendar_insert_execute.php on line 44

Strict Standards: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /homepages/42/d514133230/htdocs/adm/calendar_insert_execute.php on line 44

Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /homepages/42/d514133230/htdocs/adm/calendar_insert_execute.php on line 54

Strict Standards: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /homepages/42/d514133230/htdocs/adm/calendar_insert_execute.php on line 54

I put this in my header and I got the same error. What do I need to do to satisfy the system's concerns?

<?php
date_default_timezone_set('America/Chicago');
?>
0
Comment
Question by:brucegust
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 250 total points
ID: 39898114
That is the correct way to set it.  It does have to be set on each and every page that uses any date or time functions.  And it needs to be at the top of the page before any of those functions are used.
0
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 250 total points
ID: 39898527
You should call 1and1 and tell them you want the default timezone settings placed in the php.ini file or the .htaccess file.  It is their responsibility to provide you with a working web server, and one that is spewing messages is not working correctly.  You should not be forced to modify every one of your scripts, even if you can do that.

With that said, here is how I create a web page.

<?php require_once('common.php');
/* REST OF THE CODE GOES HERE */

Open in new window

The common.php script contains all of the common elements that my site might require - it sets the error_reporting(), starts the session, establishes the data base connection, loads all of the functions and classes, etc.  If your scripts are all started with a common.php script, you have a one-line change to add the default timezone setting, and it will be in effect on every page.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question