dj-kenpo Posted July 28, 2007 Share Posted July 28, 2007 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. Quote Link to comment Share on other sites More sharing options...
Caesar Posted July 28, 2007 Share Posted July 28, 2007 Kinda odd you wouldnt just store the timestamp. You dont have to use the hours for display later, if you don't want. Simply display the info you want minus the hours. Quote Link to comment Share on other sites More sharing options...
dj-kenpo Posted July 28, 2007 Author Share Posted July 28, 2007 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 Quote Link to comment Share on other sites More sharing options...
corbin Posted July 28, 2007 Share Posted July 28, 2007 No reason to shout at people.... Chances are the time stamp is due to timezones. Quote Link to comment Share on other sites More sharing options...
dj-kenpo Posted July 28, 2007 Author Share Posted July 28, 2007 dude, I'm not shouting, I'm just using bold to reiterate. this: $Timestamp_today = strtotime ("July 28 2007"); gives TWO different times on the different servers. this baffles me 1185606000 vs 1185595200 Quote Link to comment Share on other sites More sharing options...
corbin Posted July 28, 2007 Share Posted July 28, 2007 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. Quote Link to comment Share on other sites More sharing options...
corbin Posted July 28, 2007 Share Posted July 28, 2007 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.