Suddenly, the NOW()
function stopped saving the server's time and now I have a mess printing data using the 'time ago' implementation. It is weird.
My server's time (Hosting & MySQL) is -07:00 GMT (7:45am). My current time is: -04:00 GMT Eastern Daylight Time (10:45am).
I already corroborated the server's time using local functions.
If I save something using NOW()
, the time in the field is (2015-09-04 15:45:40
)... it is adding 8 hours ahead, I don't know why, It was working fine.
So, now I'm wondering what would be the best way to fix this? Thanks for any advice.
UPDATE
I just found out that server is using the UNIX timestamp to save things on Database.
So, my current time: -04:00 (13:48)
Server current timezone -07:00 (10:48)
Server UNIX timestamp: GMT (17:48)
Not sure if this information works to find a solution. I want it saves things using the server current timezone.
UPDATE 2
Only solution found so far was using the date
function instead of NOW()
which uses the hosting server time, not the database's.
$today = date("Y-m-d H:i:s");
This implies making changes in all scripts where I was using NOW()
...geez!