bojak71730 Posted April 28, 2006 Share Posted April 28, 2006 [code]<?php print date("g:i:s A ");print date("l, F jS, Y ");?>[/code]my problem is i cant make it tell me my system time on my computer and thats what i wana figure out instead its telling me my server time which is an hour a head of me how do i fix this? Quote Link to comment https://forums.phpfreaks.com/topic/8596-time-and-date-and-php/ Share on other sites More sharing options...
.josh Posted April 28, 2006 Share Posted April 28, 2006 php is a server side language. it is parsed on the server. you cannot get your website to display your computer's personal time using php. Quote Link to comment https://forums.phpfreaks.com/topic/8596-time-and-date-and-php/#findComment-31523 Share on other sites More sharing options...
litebearer Posted April 28, 2006 Share Posted April 28, 2006 Wellllll, he could by having his script adjust the server time by the offset of his computer OR using GMT he could remove all concern of the server time. Quote Link to comment https://forums.phpfreaks.com/topic/8596-time-and-date-and-php/#findComment-31527 Share on other sites More sharing options...
bojak71730 Posted April 28, 2006 Author Share Posted April 28, 2006 [!--quoteo(post=369432:date=Apr 27 2006, 07:54 PM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ Apr 27 2006, 07:54 PM) [snapback]369432[/snapback][/div][div class=\'quotemain\'][!--quotec--]php is a server side language. it is parsed on the server. you cannot get your website to display your computer's personal time using php.[/quote] well it wont show my time it would show anyone whose viewing it so like if u were viewing it then it would show your computer time and i think there is a way im just not sure how to it Quote Link to comment https://forums.phpfreaks.com/topic/8596-time-and-date-and-php/#findComment-31528 Share on other sites More sharing options...
.josh Posted April 28, 2006 Share Posted April 28, 2006 [!--quoteo(post=369436:date=Apr 27 2006, 09:01 PM:name=litebearer)--][div class=\'quotetop\']QUOTE(litebearer @ Apr 27 2006, 09:01 PM) [snapback]369436[/snapback][/div][div class=\'quotemain\'][!--quotec--]Wellllll, he could by having his script adjust the server time by the offset of his computer OR using GMT he could remove all concern of the server time.[/quote]yeh that's fine and dandy if all he's concerned about is it showing ONLY his time, but I somehow have this sneaking suspicion that that is not what he wants. [!--quoteo(post=369437:date=Apr 27 2006, 09:02 PM:name=bojak_cates)--][div class=\'quotetop\']QUOTE(bojak_cates @ Apr 27 2006, 09:02 PM) [snapback]369437[/snapback][/div][div class=\'quotemain\'][!--quotec--]well it wont show my time it would show anyone whose viewing it so like if u were viewing it then it would show your computer time and i think there is a way im just not sure how to it[/quote]yes i understand what you want it to do. but you can't do that in php. all php script is parsed before it ever reaches the client's computer. therefore, it is impossible for you to do this in php. now, you MAY be able to do this with some javascript. I'm not sure. I only know a few odds and ends in javascript.edit:as a matter of fact, yes you can do it with javascript. i did a google search and picked a random site and here you go (i'm sure you can take most of this code out as it makes it look all pretty and stuff):[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<!-- Paste this code into the BODY of your HTML document --><BODY><div align="center"><font face="Arial, Helvetica, Sans Serif" size="3" color="#0000FF"><b><span id="clock"><script LANGUAGE="JavaScript">// Script featured on Able2Know.com// Find free scripts & get free help: [a href=\"http://search.able2know.com/web_development/scripts/\" target=\"_blank\"]http://search.able2know.com/web_development/scripts/[/a]<!-- Original: Chris (javascript@crashedstar.com) --><!-- Web Site: [a href=\"http://www.crashedstar.com/\" target=\"_blank\"]http://www.crashedstar.com/[/a] --><!-- Beginvar dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")function getthedate(){var mydate=new Date()var year=mydate.getYear()if (year < 1000)year+=1900var day=mydate.getDay()var month=mydate.getMonth()var daym=mydate.getDate()if (daym<10)daym="0"+daymvar hours=mydate.getHours()var minutes=mydate.getMinutes()var seconds=mydate.getSeconds()var dn="AM"if (hours>=12)dn="PM"if (hours>12){hours=hours-12}{ d = new Date(); Time24H = new Date(); Time24H.setTime(d.getTime() + (d.getTimezoneOffset()*60000) + 3600000); InternetTime = Math.round((Time24H.getHours()*60+Time24H.getMinutes()) / 1.44); if (InternetTime < 10) InternetTime = '00'+InternetTime; else if (InternetTime < 100) InternetTime = '0'+InternetTime;}if (hours==0)hours=12if (minutes<=9)minutes="0"+minutesif (seconds<=9)seconds="0"+seconds//change font size herevar cdate=dayarray[day]+", "+montharray[month]+" "+daym+" "+year+" | "+hours+":"+minutes+":"+seconds+" "+dn+" | @"+InternetTime+""if (document.all)document.all.clock.innerHTML=cdateelse if (document.getElementById)document.getElementById("clock").innerHTML=cdateelsedocument.write(cdate)}if (!document.all&&!document.getElementById)getthedate()function goforit(){if (document.all||document.getElementById)setInterval("getthedate()",1000)}window.onload=goforit// End --></script></span></b></font></div>[/quote] Quote Link to comment https://forums.phpfreaks.com/topic/8596-time-and-date-and-php/#findComment-31535 Share on other sites More sharing options...
bojak71730 Posted April 29, 2006 Author Share Posted April 29, 2006 i looked at some javascript stuff and ur right i can make it in javascript thanks alot php cant do it cause it cant get the time from ur machine i had to think about that one lol thanks so much Quote Link to comment https://forums.phpfreaks.com/topic/8596-time-and-date-and-php/#findComment-31959 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.