Results 1 to 5 of 5

Thread: Local Time Script - Military time?

  1. #1
    Join Date
    Nov 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Local Time Script - Military time?

    for DD script:http://www.dynamicdrive.com/dynamicindex6/localtime.htm

    Hello,
    Would it be possible to present the time as military time? (e.g. 1556 EST) I am developing a web timesheet that could use this script if that was a feature.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Certainly. You'll have to hardcode the timezone, though.
    Change:
    Code:
    this.container.innerHTML=formatField(hour, 1)+":"+formatField(minutes)+":"+formatField(seconds)+" "+ampm+" ("+dayofweek+")"
    To:
    Code:
    this.container.innerHTML= (hour < 10 ? "0" + hour : hour) + formatField(minutes)
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Nov 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the quick reply, however, when I try that it just shows a static "51". Any suggestions?
    Last edited by ebrad; 11-23-2005 at 07:09 PM.

  4. #4
    Join Date
    Aug 2004
    Posts
    9,876
    Thanks
    3
    Thanked 962 Times in 951 Posts
    Blog Entries
    15

    Default

    How about this. Change:

    Code:
    this.container.innerHTML=formatField(hour, 1)+":"+formatField(minutes)+":"+formatField(seconds)+" "+ampm+" ("+dayofweek+")"
    to:

    Code:
     
    this.container.innerHTML=hour+":"+formatField(minutes)+":"+formatField(seconds)+" ("+dayofweek+")"

  5. #5
    Join Date
    Nov 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It works! Thank you so much for your help.

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
  •