skip to Main Content

This code date("H:i") return invalid hour:min for me.

Current time windows server 2016 is 10:55 But date("H:i") return 11:55 !?

My PHP version is 5.6.37 and install timezonedb extention but I still have this problem.

I set time zone to Asia/Tehran and get current value with date_default_timezone_get() everything all right.

enter image description here

Result PHP code:

enter image description here

2

Answers


  1. Iran now has Daylight Saving Time, so I suggest you update your operating system, or use an external 3rd party service to get the current time.

    get more information at Official Time Zone Authority

    Login or Signup to reply.
  2. I found the news here https://www.timeanddate.com/news/time/iran-dst-2022.html, it says Iran has decided to cancel DST from 2023, so make sure you have installed the lastest timezonedb extension. You can check it with the following code:

    date_default_timezone_set('Asia/Tehran');
    echo date('I'); # should be 0
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search