arcticsnpr 0 Report post Posted November 1, 2006 hey, i know the issue of time and date with php and just been posted. But honestly, i didn't get the answer i neeed. I'm building a user personalization website, and i need help with the time. It all get messed up because the server is in a diiferent time zone. Should i use gmdate() function? because i'm using date().All that said, whats the best way to use time and dates for like a forum in php? Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted November 1, 2006 Using gmdate() makes the script more portable since all the adjustments are then made against GMT time, so go with that if you plan on making it work on several other servers or if the Server changes time zones.Each user's time adjustment would then be an offset from GMT rather than the Server's Local time.Either way, an adjustment would be required unless they were in the correct zone. Share this post Link to post Share on other sites
midnitesun 0 Report post Posted November 2, 2006 as jihaslip has said using gmdate() is always the best opition which then can be adjusted by the user in accordance to his time zone , for which you just have to include a little extra code if you don not have one already Share this post Link to post Share on other sites
electron 0 Report post Posted November 2, 2006 Well then what to do if we are to store the GMT time in the database. According to the IST(Indian Standard Time-I live in India) we are 5 and a half hours ahead of GMT.I tried using gmmktime() function and it returns me the time + 5 and a half hours ahead of IST instead of 5 and a half hours behind IST.So just one suggestion use time() store it in the database and then use gmdate to get the GMT time. But this thing has a disadvantage you know. Whenever you change the server to a different one the time settings being different the GMT time and the time itself would be going wrong. Share this post Link to post Share on other sites
arcticsnpr 0 Report post Posted November 2, 2006 ok thanks so much for your help guys! much appreciated Share this post Link to post Share on other sites
cnetboss 0 Report post Posted November 6, 2006 thanks guys, I also have some issue about the date() function because I want to match my date and time in my area (I'm in GMT+8 area) Share this post Link to post Share on other sites