hello,
first of all, i just know the basics of php and am familiar with mysql basically. so, i'm not like really good at this stuff.
i have a huge issue with time & date in php and don't really have a solution, because there are so many things you have to consider.
what i want to do is display is the current time and date.. (format doesn't really matter) First issue is that the normal php date function takes the date and time from the computer clock. and when the computer clock is wrong the wrong date / time will be displayed, right? Second problem is that people from all over the world will come to my site, so i have to display the right time of each timezone.
i think this is all you have to worry, when you program an personal message system, right? i really hope that somebody can help me, either with telling me exactly which functions to use and how i do that stuff or maybe somebody know a free script that can do what i want to do. so, i hope i can get some good advice here, thanks a lot guys ...
php and a Date question?
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: php and a Date question?
Use Javascript to show the date/time instead. Since that runs in the browser it will show their local system's time.
(#10850)
Re: php and a Date question?
As arborint mention, Javascript is something really worth looking into. You'll never be completely sure about the users time tho, no matter what type of code you are using. This link about timezones is perhaps not really what you need, but can get some ideas from it.
Other ideas is to ask the user about "if this time <here> correct according to your clock" and storing that info in a cookie/database. Play around with it and good luck.
Other ideas is to ask the user about "if this time <here> correct according to your clock" and storing that info in a cookie/database. Play around with it and good luck.
-
DonPatrizio
- Forum Newbie
- Posts: 3
- Joined: Fri Jan 25, 2008 11:34 pm
Re: php and a Date question?
I think that I heard that I can somehow get the current time from my server perhaps?? The server time can't be altered by any user, so that would display always the correct time, right? Of course, i don't know how to do that ..
I'll also have a look at javascript and date, actually i know javascript a bit ..
thanks
I'll also have a look at javascript and date, actually i know javascript a bit ..
thanks
Re: php and a Date question?
See the link in my post above and the very first example for a tip. Also the table of contents on the php site, for various of functions that might be handy.DonPatrizio wrote:I think that I heard that I can somehow get the current time from my server perhaps?? The server time can't be altered by any user, so that would display always the correct time, right? Of course, i don't know how to do that ..
I'll also have a look at javascript and date, actually i know javascript a bit ..
thanks