Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date/Time Stamp Upon Click of Radio Button

R5 - Web Applications

Date/Time Stamp Upon Click of Radio Button

by  NiteLink  Posted    (Edited  )
Place the following in the onClick of the radio option:

var mydate=new Date()
var year=mydate.getYear()
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
var daym=mydate.getDate()
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var dn="AM"
if (hours>12){
dn="PM"
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes

var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")

document.forms[0].FieldName.value = dayarray[day] + ", " + montharray[month] + " " + daym + " " + ", " + year + " " + hours + ":" + minutes + dn

It will display as Thursday, October 9, 2003 10:20AM

This is normally used when you want to keep track of approvals.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top