Results 1 to 4 of 4

Thread: I need the LCD clock in 24 hour format

  1. #1
    Join Date
    Mar 2009
    Location
    Jerusalem, Israel
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I need the LCD clock in 24 hour format

    1) Script Title: LCD clock

    2) Script URL (on DD):http://www.dynamicdrive.com/dynamicindex6/lcdclock.htm

    3) Describe problem: I need the LCD clock in a 24 hour format without the AM and PM. Can someone tell me the script for it? Thanks.

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    In the script itself, find and remove the highlighted below:

    Code:
    <script>
    <!--
    
    /*****************************************
    * LCD Clock script- by Javascriptkit.com
    * Featured on/available at http://www.dynamicdrive.com/
    * This notice must stay intact for use
    *****************************************/
    
    var alternate=0
    var standardbrowser=!document.all&&!document.getElementById
    
    if (standardbrowser)
    document.write('<form name="tick"><input type="text" name="tock" size="6"></form>')
    
    function show(){
    if (!standardbrowser)
    var clockobj=document.getElementById? document.getElementById("digitalclock") : document.all.digitalclock
    var Digital=new Date()
    var hours=Digital.getHours()
    var minutes=Digital.getMinutes()
    var dn="AM"
    
    if (hours==12) dn="PM" 
    if (hours>12){
    dn="PM"
    hours=hours-12
    }
    if (hours==0) hours=12
    if (hours.toString().length==1)
    hours="0"+hours
    if (minutes<=9)
    minutes="0"+minutes
    
    if (standardbrowser){
    if (alternate==0)
    document.tick.tock.value=hours+" : "+minutes+" "+dn
    else
    document.tick.tock.value=hours+"   "+minutes+" "+dn
    }
    else{
    if (alternate==0)
    clockobj.innerHTML=hours+"<font color='lime'>&nbsp;:&nbsp;</font>"+minutes+" "+"<sup style='font-size:1px'>"+dn+"</sup>"
    else
    clockobj.innerHTML=hours+"<font color='black'>&nbsp;:&nbsp;</font>"+minutes+" "+"<sup style='font-size:1px'>"+dn+"</sup>"
    }
    alternate=(alternate==0)? 1 : 0
    setTimeout("show()",1000)
    }
    window.onload=show
    
    //-->
    </script>
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Mar 2009
    Location
    Jerusalem, Israel
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you very much. I'm very new at this, so can you tell me how I go about putting it on a certain spot in my page? I've never done it before.
    Thanks.

  4. #4
    Join Date
    Mar 2009
    Location
    Jerusalem, Israel
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Can someone tell me how I can alter the script so that the clock shows just one constant, fixed time of 20:20, but still have the ":" blinking, instead of telling the time?
    Last edited by dovidshmuel; 03-21-2009 at 08:01 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •