Date time problem


Error Message

The date time is still in 2021 and the day is always +2 ( for example if we are at 21st it shows at 23rd)

Other Information

Please help me resolve this problem !!

Hi and welcome back!

The server time or MySQL time? We’ve seen instances of this before, and usually it can only be resolved by Admin contacting iFastNet for them to fix it.


Indeed. This is indeed a server time sync issue that needs a server admin to fix this. Then we do need to know what to fix though, so can you please clarify how exactly you’re generating this time? We use separate web server and database servers, which may have (but shouldn’t have) different system clocks.


Thank you for your fast response ,
I tried to get the time using the default current timestamp in phpmyadmin ( neither the date or the time is correct) , i tried also using php code as follows also the same result , so now I really don t know what to do to solve this issue .
Php code :

// Set the new timezone
$date = date('d-m-y h:i:s');
echo $date;
1 Like

Can you share what that code is outputting, as well as the time that you ran it at?


I run it at : 2023-01-21 14:48:42 got 2021-01-23 02:48:42

1 Like

OK, that actually helps a lot.

Honestly, I highly doubt the server time is incorrect. Given that the minutes and seconds are exactly the same make me suspect that the problem is with time zone settings.

For starters, our servers are all configured in UTC-5 (EST). This includes web servers and database servers.

Also, the MySQL times are always in the system time. So if you use something like current_timestamp() they will always be in UTC-5.

Are you sure it said exactly that? Looking at the code, it should say 21-01-23 02:48:42. And that is exactly how it’s supposed to work.

Why is that? Because you used the formatting string d-m-y. So in the printed date, it says the 21st day of the month in the year '23. Which is exactly correct. If you want it to say 2023-01-21, you’d need to use the date string Y-m-d.

For the time, the problem is similar. You are using the lowercase h to display the hour. But this character is for the 12-hour notation. If you want to display the full time, you could either add the a or A letter to your date string to add AM/PM, or use the capital H to display the hours in 24-hour notation.

In short: the server time is correct. But what you get depends on your date formatting string. If you give the date function an ambiguous, incomplete or incorrect time string, you’ll see an ambiguous, incomplete or incorrect time.

Be sure to check the documentation to see what all the letters actually do and which letters you need to get the date and time representation you want:


Thank you for your help , it working now.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.