Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Register your account to receive email notifications when new services and mods are added.


This forum is now closed and has moved to a new location! Click here to find out why.

AuthorTopic: Game time/clock  (Read 1065 times)

Dusty

  • Basic Member
  • *
  • Reputation Power: 21
  • Dusty has no influence.
  • Offline Offline
  • Posts: 39
  • TRD Computer Repair
    • Yahoo Instant Messenger - peewee986
    • View Profile
    • WWW
Game time/clock
« on: September 22, 2009, 11:04:38 PM »
I have a clock or what ever you what to call it on my site.    ,,,,,   Time is now
Wed 1:02:07 am
EST 

How do i make it where  the time changes with out the player having to hit refresh all the time ..     Also   Does any one know where I can find different Codes for times or clocks. Thanks
Logged
TRD Computer Repair Services
www.trdcomputer.com

Danny696

  • Senior Member
  • ****
  • Reputation Power: 317
  • Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.
  • Offline Offline
  • Posts: 540
    • View Profile
    • WWW
Re: Game time/clock
« Reply #1 on: September 23, 2009, 10:55:51 AM »
Ermm try javascript clock mabey
Logged
Project Choosen - 10%
Daniel - Hanson . Com

Dusty

  • Basic Member
  • *
  • Reputation Power: 21
  • Dusty has no influence.
  • Offline Offline
  • Posts: 39
  • TRD Computer Repair
    • Yahoo Instant Messenger - peewee986
    • View Profile
    • WWW
Re: Game time/clock
« Reply #2 on: September 23, 2009, 12:08:23 PM »
Thanks ..   Looked all last night for a short code clock .. LMAO .. o well  its just a minor look thing .. im not going to bust a load looking for it ..   LOL
Logged
TRD Computer Repair Services
www.trdcomputer.com

Spudinski

  • Basic Member
  • *
  • Reputation Power: 42
  • Spudinski has no influence.
  • Offline Offline
  • Posts: 53
  • I have cookies!
    • View Profile
    • WWW
    • Email
Re: Game time/clock
« Reply #3 on: November 08, 2009, 04:14:59 AM »
Try this snippet;
Code: [Select]
<script type="text/javascript">
<!--

function updateClock ( )
{
  var currentTime = new Date ( );

  var currentHours = currentTime.getHours ( );
  var currentMinutes = currentTime.getMinutes ( );
  var currentSeconds = currentTime.getSeconds ( );

  // Pad the minutes and seconds with leading zeros, if required
  currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
  currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;

  // Choose either "AM" or "PM" as appropriate
  var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";

  // Convert the hours component to 12-hour format if needed
  currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;

  // Convert an hours component of "0" to "12"
  currentHours = ( currentHours == 0 ) ? 12 : currentHours;

  // Compose the string for display
  var currentTimeString = "Time: " + currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;

  // Update the time display
  document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}

setInterval('updateClock()', 1000);

// -->
</script>

Reference: http://www.elated.com/articles/creating-a-javascript-clock/
Logged
If you see a post that just doesn't just seem right, send me a PM.
Offering services for small-type games and websites, send me a PM if you want/need something done.

gambino

  • Active Member
  • **
  • Reputation Power: 0
  • gambino is looked down upon.gambino is looked down upon.gambino is looked down upon.
  • Offline Offline
  • Posts: 113
    • View Profile
Re: Game time/clock
« Reply #4 on: November 22, 2009, 02:26:33 PM »
every server has a CGI tab. sign into the server cpanel and go under the tab called "software / services" and look for "CGI center". click on it and then click on "clock". set your time zone to your timezone and stuff. make it and make sure it is the one that has the seconds. create the HTML on the tab below and look at the javascript clock to see if you like it.

take the HTML and put it on your mainmenu.php file.

simple.
Logged
 


This forum is now closed and has moved to a new location! Click here to find out why.