Php Time! Help!

free web hosting
Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Php Time! Help!

arcticsnpr
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?

Reply

jlhaslip
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.

Reply

midnitesun
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

Reply

electron
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.

Reply

arcticsnpr
ok thanks so much for your help guys! much appreciated biggrin.gif

Reply

cnetboss
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)

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics
Looking for php, time

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for php, time

*MORE FROM TRAP17.COM*
advertisement



Php Time! Help!



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE