Does anyone have some quick tips on how to calculate time - I have managed successufully to calculate the time but I'm having a hard time deducting another field (lunch hour).
????
886 Views
3 Replies
Latest reply:
MrFranciscoVaz, Aug 16, 2011 6:55 AM
You basically will need an understanding of the Date() object in the JavaScript model.
Some methods:
getDate() - day of the month
getDay() - day of the week
getHours() - hour (0-23)
getMinutes() - minutes
getSeconds() - seconds
getMonth() - month (0-11)
getYear() - year
getTime() - time in full format
To produce today's date:
var today_date= new Date()
var myyear=today_date.getYear()
var mymonth=today_date.getMonth()+1
var mytoday=today_date.getDate()
document.write("Today's date is: ")
document.write(myyear+"-"+mymonth+"-"+mytoday)