Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1007069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:33:40+00:00 2026-05-16T08:33:40+00:00

//Live Javascript Server Time function getthedate(){ var mydate=new Date() var hours=mydate.getHours() var minutes=mydate.getMinutes() var

  • 0
//Live Javascript Server Time
function getthedate(){
    var mydate=new Date()
    var 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
        }
        if (hours==0)
        hours=12
        if (minutes<=9)
        minutes="0"+minutes
        if (seconds<=9)
        seconds="0"+seconds

    var cdate="<strong><font color='b9b9b9' size='1'> "+hours+":"+minutes+":"+seconds+" "+dn+"</font></strong>"
    if (document.all)
    document.all.clock.innerHTML=cdate
    else if (document.getElementById)
    document.getElementById("clock").innerHTML=cdate
    else
    document.write(cdate)
    }
if (!document.all&&!document.getElementById)
getthedate()
function live_servertime(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
}

Does this display the live SERVER time? If not, any ideas how to achieve this?
Also I’m stumped on how to modify it to put a zero in front of hours that are less than ten?

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T08:33:41+00:00Added an answer on May 16, 2026 at 8:33 am

    If you understand how the minutes and seconds get the leading zero, it should be pretty obvious.

        if (hours==0)
        hours=12
        if (hours <= 9)          // <--
           hours = "0" + hours;  // <--
        if (minutes<=9)
        minutes="0"+minutes
        if (seconds<=9)
        seconds="0"+seconds
    

    and no, new Date() just gets the time from the client.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

JavaScript: $('.addTable').live('click', function () { var appendTxt = <table id='tab1'> <tr><td><input type='text' name='input1' /></td><td><input
I have this function: <script type='text/javascript'> $('#clicktogohome').live('click', function(){ history.pushState({}, '', this.href); popstate(this.href); return false;
Here's some simple Javascript: (function($){ var ajax_callback = function(data) { window.location.hash = data.h1; };
Live streaming video in html 5 - what is required from server to stream
So I am learning about javascript, so I am making a live chat system
here is the code: <script type=text/javascript> var ajax_data = '<ul id=b-cmu-rgt-list-videos><li><a href={video.url} '+ 'title={video.title.strip}><img
Possible Duplicate: Run javascript function when user finishes typing instead of on key up?
Is there a way to have a live connection (like for a chat server)
This is my definition $(.HideOnClick).live({ click: function () { deactive_tiptip() } }); This is
i have a jquery function which i want to convert to .live because i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.