| | |||||
| ||||||||
| CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: Mar 2006
Posts: 227
![]() ![]() ![]() | Simple Date Output! [PHP] Every wonder how larger corporate sites have the date displayed and automatically changed everyday? Javascript? No there is a much more easier way than that! Simple put: PHP Code: ????: NamePros.com http://www.namepros.com/code/273463-simple-date-output-php.html Tuesday, December 26, 2006 More tutorials coming soon at: http://www.netsuhi.com |
| |
| | #8 (permalink) |
| NamePros Regular Join Date: May 2005 Location: England
Posts: 390
![]() ![]() ![]() | suhithar i dont mean to be rude and i know you're trying to help, but if most people want to learn the date function they will just search on php.net where it has plenty of examples. Focus on writing a worthwhile script than just giving examples of lots of php functions.
__________________ -Beaver6813.com - Web Developer Extraordinaire! |
| |
| | #9 (permalink) | ||||
| Account Suspended Join Date: Apr 2006 Location: Belgium
Posts: 442
![]() ![]() ![]() ![]() ![]() ![]() |
![]() It is also so that PHP itself is unabled to detect the timezone of the visitor (you can guess the timezone of course with IP2country databases and so of course, but thats just guessing), so it will just show the time of the server mostly - and a visitor might get confused by the time then. PHP does can detect if javascript is enabled on the useragent of the browser. So what the best thing is to do in my opinion about showing time or date, is letting PHP see if the browser has javascript enabled (=> browscap), and if javascript is enabled, use the javascript function. Else print server time, or GMT time (gmdate()) and a clear statement of which timezone the time displayed is. ????: NamePros.com http://www.namepros.com/showthread.php?t=273463 .. just a suggestion though | ||||
| |
| | #10 (permalink) |
| Soon to be RICHdoggie! Join Date: Jan 2005 Location: UK
Posts: 2,408
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | you could have a "change your timezone" link as well if you wanted. and store the user's preference in a session, or even better a cookie. I cba to go into it at the moment, but its easy enough to look up cookies and sessions on php.net as well. Tom |
| |