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
Share on other sites

for what I'm doing I DON'T want the hours. I am storing ONE timstamp universal per day. it's to track how many bots hit the site. storing an exact tiemstamp woudl result in thousands of rows per day rather than one with incremental click value

Link to comment
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.

Link to comment
Share on other sites

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.

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.