Jump to content

timestamp inconsistency between servers


dj-kenpo

Recommended Posts

little confused, on my localhost vs my server I get 2 different timestamps for "July 28 2007"

 

same code,

$month = date("F");
$date = date("d");
$year = date("Y");
$Timestamp_today = strtotime ("$month $date $year");

 

my understadnign is they shoudl e the same as all I want to store is month/day/year not hours

 

yet localhost gives me "1185595200"

and my host server gives me "1185606000".

 

what am I doing wrong? i just want the bare date with no hours and I'd liekt hem to be the same. and YES my tiem is set correct on my computer and the server is the same, minu it's ina  different tiem zone, but again, if hours are ignored, it shouldn't matter.

Link to comment
https://forums.phpfreaks.com/topic/62245-timestamp-inconsistency-between-servers/
Share on other sites

I usually interpret caps and bold as yelling ;p.

 

Do their timezones happen to be 3 hours apart?

 

Yes, you're not asking for hours, but think about this:

 

July 28th starts when July 27th 23:59 turns into 24:00, thus even days depend on hours.

 

For GMT -0 it would still be the 27th when it was the the 28th and 0:00 for GMT +1 if ya know what I mean.

Hmmmm just thought about this:

 

$timestamp = time();

$timestamp = $timestamp - ($timestamp % (1440))

 

That would shave off the seconds that didn't make it an even day, but on the two servers if the time zones happened to overlap, it would still have problems.... Just might be faster than data and str to time.... Not sure though.

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.