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.)

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.