Jump to content

Recommended Posts

Hello!

 

This problem has been driving me insane.  Ok so I am making a news article script that stores its information into a mysql database.  My script for adding information seems to be working great, with one problem.  The time() function returns a time that is a decade ahead (this is on a hostgator server also, they said they cannot do anything about it).  So my question is, is there a way to subtract a decade off of it, or is there a different way to get the current time other than using the servers time?

 

$future_date = time() - (3612 * 24 * 60 * 60);
$today = date("d-m-y H:i:s", $future_date);

 

The 3612 is the exact amount of days it is off including leap years.  The odd thing is this actually adds a decade to it, so it used to be 6/11/2021, now it is 7/01/31.

 

 

Thanks guys for any help!!

That's really strange, both that the server time is off (and they won't change it) and that you're getting that result now. Are you sure it's still off by 10 years? Try this and tell us what output it gives back now:

 

echo date("d-m-y H:i:s");

It gives me back 6/11/2021

 

Lol, odd problem.  I was thinking of contacting them again.  They sent me to a link that said that they will not change the server time, but I would have assumed it would only have been off by times zones, not decades.

 

Thanks for the response!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.