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 8803791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:26:02+00:00 2026-06-14T01:26:02+00:00

I am having huge issues with php time. For some reason it shows a

  • 0

I am having huge issues with php time.

For some reason it shows a different time (by 2 hours) to some users and the correct time to other users.

The code is H:i:s d-M-y T when I view the page in a browser from my PC it tells me its 11am when infact its 9am, when I check via a browser using one my RDP’s I get the correct time.

Both PC’s are in the country (uk) both PC’s have the same system time etc.

Tried setting the timezone default, but no matter what I do the server still shows some users the correct time, and other users the time 2 hour forward, any ideas?

the code is echo gmdate("H:i:s d-M-y T");

<?php echo gmdate("H:i:s d-M-y T"); ?>
  • 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-14T01:26:04+00:00Added an answer on June 14, 2026 at 1:26 am

    As a work around, let me explain this: There are users who get the right time, others get -2h. If we log the last time in a file, and next time a user opens the page, we check if $now is smaller than $last_time, if it is, we add 2 hours ! Let me explain this with numbers, User1 visited the page, and it returns the right hour, let’s say 11AM. User2 opens the page, and it return 9AM, obviously we can’t return in the time, so we add 2 hours !

    Here the code:

    <?php
    $last_time = file_get_contents("file.txt"); // a file where the last time has been saved
    $now = strtotime(gmdate("H:i:s d-M-y T")); // Now !
    if($now < $last_time){
        $now += 7200; // add 2 hours !
    }
    file_put_contents("file.txt", $now);
    echo gmdate("H:i:s d-M-y T", $now);
    ?>
    

    Hope this was helpful !

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

Sidebar

Related Questions

I'm having some issues with CLLocation distanceFromLocation. I have the code below, formatted to
I'm having some huge performance issues with facet queries. I have an index of
Suppose I have some PHP code running inside a web server, for example, running
I am having a huge issues with DotLess on AppHarbor. I have setup my
IE8 and below are having huge performance issues when it comes to searching a
I am having some issues with a group query with MySQL. Question Is there
I'm having some issues trying to Compile a DLL, but I just can't see
I have a huge web app that is having issues with memory leak in
I'm having some memory leak issues in a perl script that I'm running for
We're having huge issues with Java Web Start in production. We're afraid to release

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.