Jump to content
xisto Community
Sign in to follow this  
arcticsnpr

Php Time! Help!

Recommended Posts

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

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

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.