View Full Version : Local Time Script - Military time?
ebrad
11-22-2005, 09:00 PM
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.
Certainly. You'll have to hardcode the timezone, though.
Change:
this.container.innerHTML=formatField(hour, 1)+":"+formatField(minutes)+":"+formatField(seconds)+" "+ampm+" ("+dayofweek+")"
To:
this.container.innerHTML= (hour < 10 ? "0" + hour : hour) + formatField(minutes)
ebrad
11-22-2005, 10:16 PM
Thanks for the quick reply, however, when I try that it just shows a static "51". Any suggestions?
ddadmin
11-23-2005, 09:13 AM
How about this. Change:
this.container.innerHTML=formatField(hour, 1)+":"+formatField(minutes)+":"+formatField(seconds)+" "+ampm+" ("+dayofweek+")"
to:
this.container.innerHTML=hour+":"+formatField(minutes)+":"+formatField(seconds)+" ("+dayofweek+")"
ebrad
11-23-2005, 08:08 PM
It works! Thank you so much for your help.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.