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

  • Home
  • SEARCH
  • 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 8934915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:52:58+00:00 2026-06-15T09:52:58+00:00

I know the time zone can be changed by the following methods (and maybe

  • 0

I know the time zone can be changed by the following methods (and maybe more):

  1. Set putenv() with the time zone in every php file.
  2. Set date.timezone with the time zone in php.ini.
  3. Set php_value date.timezone with the time zone in the root .htaccess file.

My question is, does setting the time zone only affect the date() function, or does it also affect the time() function?

I read the documentation, but I’m still a little confused.. I think the answer is the former, but I need to make sure, so it would be great if someone could confirm this.

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-15T09:52:58+00:00Added an answer on June 15, 2026 at 9:52 am

    time() isn’t affected by timezone. functions like date, convert the resulting date to the timezone without affecting the timestamp.

    <?php
    var_dump(date_default_timezone_get());
    
    $time1 = time();
    var_dump($time1);
    var_dump(date("r", $time1));
    
    date_default_timezone_set("America/Los_Angeles");
    var_dump(date_default_timezone_get());
    
    $time2 = time();
    var_dump($time2);
    var_dump(date("r", $time1));
    
    var_dump($time1 === $time2);
    

    Outputs:

    string(16) "Europe/Amsterdam"
    int(1571676424)
    string(31) "Mon, 21 Oct 2019 18:47:04 +0200"
    string(19) "America/Los_Angeles"
    int(1571676424)
    string(31) "Mon, 21 Oct 2019 09:47:04 -0700"
    bool(true)
    

    Demo: https://3v4l.org/Cggc3

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

Sidebar

Related Questions

I would like to know how I can set the MySQL time zone to
If I know the Time.zone e.g. London, any ideas on how I can display
I have a web server which I do not know what the time zone
I know my file system is storing the file modification time in milliseconds but
Does anyone know if there is a function to obtain the server's time zone
I have asked aqbout timezones and date/time before but this is a more specific
I would like to know how I can change the date in my selectedDate
Changes to time zones do occur from time to time, I know every year
How to get the local date and time in PHP.For example my timezone is
I need to check user's time zone... but I can't find how it defined

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.