Jump to content

Generate UTC TimeStamps By Range


JustinK101

Recommended Posts

time() returns the current timestamp in GMT (which is the same as UTC, right?) So here are the two values you want:

 

$now = time();
$seven_days_ago = $now - 60*60*24*7;

 

60*60*24*7 is the number of seconds in 7 days (60 seconds in a minute, 60 minutes in an hour, 24 hours in a day, and 7 days.)

Link to comment
Share on other sites

That's the point, I need the date/time to be static, meaning wherever the server is, the date/time is always the same. We actually are going to have web servers located on both the west and east coast, both running the same PHP application. Basically every date/time must be stored in UTC in the database.

Link to comment
Share on other sites

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.