Help with Local time PHP code - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Skype & Technology (/forumdisplay.php?fid=9) +---- Forum: Tech Talk (/forumdisplay.php?fid=17) +----- Thread: Help with Local time PHP code (/showthread.php?tid=54399) Help with Local time PHP code by Salem on 12-30-2005 at 04:04 PM
I have used the local time script from Dynamic Drive on a webpage, however, on the page i get NaN:NaN:NaN AM where the time should be (when set to short format). RE: Help with Local time PHP code by rix on 12-30-2005 at 04:14 PM
I'm not sure, did I understand you correctly, but why don't you just use simple PHP date functions? You can easily show time by doing this: code: Also take a look at these functions: date_default_timezone_set() date_default_timezone_get date() RE: RE: Help with Local time PHP code by Salem on 12-30-2005 at 04:17 PM
quote: Yeh, but im totally new to PHP. If some can help i'd be very greatful RE: Help with Local time PHP code by hmaster on 12-30-2005 at 04:54 PM
Use the date() function to get the server time -> http://uk2.php.net/manual/en/function.date.php RE: RE: RE: Help with Local time PHP code by rav0 on 12-31-2005 at 01:44 AM
quote: quote:You must rename your files to something.php, they can't be something.html for PHP to work (except for exceptions). Sorry if you already knew this. Inside a file called something.php, put this: code:Wherever in the file you put it, PHP shpuld make it come out like 12:35 PM (the current time). Instead of g:i A, you can put other things to have the time in a different format. Refer to date in the PHP manual for the parameters you can use. Though if you are having problems still, maybe the time is not working on the server. RE: RE: RE: RE: Help with Local time PHP code by Salem on 01-01-2006 at 08:19 PM
quote: yes i was aware about this quote: Thanks, this does help. Will this method constantly update the time, or will it only be accurate on every refresh. The script i tried using updates the time on the webpage constantly. Salem RE: Help with Local time PHP code by Ezra on 01-01-2006 at 08:49 PM
This will only be accurate on every refresh, this is the way php works. RE: RE: Help with Local time PHP code by Salem on 01-01-2006 at 08:54 PM
quote: Thanks, yeh i thoguth that would be the case. Thanks for the help guys. RE: Help with Local time PHP code by hmaster on 01-01-2006 at 10:26 PM
JS Date -> http://www.w3schools.com/js/js_obj_date.asp |