Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9325201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T04:46:47+00:00 2026-06-19T04:46:47+00:00

I’ve been receiving the usual PHP warnings for using strtotime without setting a default

  • 0

I’ve been receiving the usual PHP warnings for using strtotime without setting a default time zone:

PHP Warning: date_default_timezone_get(): 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/Chicago’ for ‘CST/-6.0/no DST’ instead

I read up a lot on what needs to be done, and basically there doesn’t seem to be a way around setting a default timezone (either in php.ini as date.timezone = “America/Chicago”, or in PHP using date_default_timezone_set(‘CST6CDT’) or similar).

My problem is that we have a moving server that will frequently be in different time zones for demos, so I can’t just set a fixed timezone and have everything work wherever we go…

Or can I? There’s of course also the possibility that I’m completely misunderstanding the whole timezone concept 😉 Frankly, it’s just confusing me more the more I read about … I also don’t know for sure how the server’s system time is affected by plugging it into a network in a different time zone – there’s just too much I don’t know or understand yet (sorry…).

Main reason I want these error messages to stop is that I have to sift through the error logs a lot since this is also my development server, and having to filter all these lines out is just a major pain…

On top of all of that, the application on the server not only uses local times, but it also synchronizes some data with our static server, so I am painfully aware that I’ll have to adjust a lot of main server code as well, and for that I can easily force our actual time zone or UTC.

So what’s the best option here?

Should I simply hard code UTC in as default time zone, then create a setting in my database and a user interface that we can use to switch time zones and update ALL my code to use all of that, or is there a better and simpler way?

Or should I ignore the whole issue and add @ to every strtotime I use? (bracing myself for a small riot…) 😉

Looking forward to any suggestion…
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T04:46:49+00:00Added an answer on June 19, 2026 at 4:46 am

    Andy Jones is correct. Your best bet is to baseline your server completely. What I mean by this is to set all encodings (bash, mysql) to UTF-8 and timezones to UTC. If you do this from the outset, you will save yourself a lot of headache down the road.

    With respect to the question you asked, if you store all timestamps in your database as UTC, then you only need to convert based on the end user’s timezone. This avoids having to determine if a timezone stored in the database was PST or EST then convert to user’s timezone. Plus it allows you to move servers between timezones. For example if you are using VPS across multiple timezones, each of which feeds into the same database, you are ensured that all timezone entries are consistent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I am using JSon response to parse title,date content and thumbnail images and place
this is what i have right now Drawing an RSS feed into the php,
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.