PDA

View Full Version : Articles date added showing 2 hours ahead of my time?


risrik
05-11-2007, 09:13 PM
Hi, I was just adding an article and noticed that the 'date added' time is two hours ahead of my time (I just added it at 2:49pm and it's showing on the site as 4:49pm - same day!). I'm in Central and it's showing Atlantic.

Is it possible to tell the system to generate times based on Central (or my server which is also Central)?

Thank you for any help you can provide.

James
05-11-2007, 10:01 PM
It uses the server time to set it.

I know it can be confusing to you but since you have surfers from all over the world the date never will really matter when we are talking two hours.

If a vps or dedicated server you can always set the server time to your location

shadav
05-12-2007, 01:09 AM
i had this problem as well

http://www.phplinkdirectory.com/forum/showthread.php?t=10496

look for proprod's post #9 :)

James
05-12-2007, 02:36 AM
wrong link .....


I guess I just don't see the need to have my servers as the same time as me :)

shadav
05-12-2007, 02:41 AM
lol opps i edited it, i forgot the 6 at the end :D

I guess it doesn't really matter, but since it's my site and i'm the one that runs it ;) would like the time stamps to be in my time zone for the date added and the x approved posts today :D

risrik
05-16-2007, 03:07 AM
Hi,

Sorry it took me a few days to get back. I just put up another article and now it's 5 hours ahead!

I went to the index.php page and echoed this
echo strftime('%m/%d/%Y %H:%M:%S', time()); and my time is properly output. I'm on a central zone server and I'm in central time.

What are the articles doing differently to get a different time? If someone could let me know as to the file where this is put into the DB, that would be great.

Thanks for your help guys and gals.

shadav
05-16-2007, 01:37 PM
my guess would be to do that in the article.php file

risrik
05-16-2007, 05:36 PM
Okay, figured it out. It is not getting the server time - it gets GMT with the gmdate function. If it got the server time it wouldn't be a problem.

I replaced every occurrence of

Content visible to registered users only.with

Content visible to registered users only.and that fixed the problem. If you had an offset from your server, you'd have to account for it when you generate the time() parameter. Otherwise, if you have the same time as your server, use the above.

Hope this helps!

Thanks peeps!