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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:57:13+00:00 2026-06-11T06:57:13+00:00

I have the following code: var_dump(new \DateTime(‘now’, new DateTimeZone(‘GMT’))); which i get the following

  • 0

I have the following code:

var_dump(new \DateTime('now', new DateTimeZone('GMT')));

which i get the following output, which is one hour behind:

object(DateTime)#894 (3) { ["date"]=> string(19) "2012-09-13 13:54:26" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "UTC" } 

However if i change the code to the following:

var_dump(new \DateTime('now', new DateTimeZone(date_default_timezone_get())));

I then get the folling output which is right:

object(DateTime)#894 (3) { ["date"]=> string(19) "2012-09-13 14:54:26" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/London" } 

I was reading on Derick Rethans blog that with timezone 3 it should take into account, any daylight saving hours, can anyone explain why on the first code snippet I get one hour before what it actually is?!

  • 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-11T06:57:14+00:00Added an answer on June 11, 2026 at 6:57 am

    Well, in the first snippet you’re asking for a time zone of “GMT”. That’s a somewhat ambiguous term, but I’d normally expect that to mean exactly GMT itself – roughly equivalent to UTC, and without any daylight saving time. That’s why it’s not applying daylight saving time, and it’s reporting the time zone as UTC.

    The Europe/London time zone spends half the year in GMT, and half the year in BST.

    I would suggest that you steer clear of 3-letter time zone abbreviations wherever possible. They’re full of all kinds of possibilities for failure. (Having now read the blog post, that’s basically what’s being suggested there too.)

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

Sidebar

Related Questions

I have the following code: var carsContext = new CarsDataContext(); IQueryable<Car> allCars = carsContext.Cars;
I have the following code: var tlp = new TableLayoutPanel { Location = new
I have the following code: $theinput = new inputSmartSearch($db, chooseproduct, Choose Product, $therecord[product], Choose
I have the following code. I am trying to get just the name of
I have the following code and when i try to get a value from
I have the following code: var_dump($cumulitive); $y_axis_max = max($cumulitive)*1.3; var_dump($y_axis_max); It outputs the following:
I have the following code: $link = new PDO(mysql:dbname=$databasename;host=127.0.0.1,$username,$password); $query = $link->prepare(SELECT * FROM
I have the following code snippet I'm trying to get the text from: <span
I have the following code: JSONObject jsonRequest = new JSONObject(); jsonRequest.put(id, 1); jsonRequest.put(method, mymethod);
I have the following php code, which has been snipped for brevity. I am

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.