Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
10-17-2006, 03:01 PM #1
- Join Date
- Oct 2006
- Thanked 0 Times in 0 Posts
Unsure how to handle advanced date calculations
I need to come up with a leave application script. For example i have 21days of annual leave. The actual amount will be taken from a database. If i select today from the drop down box and one week later in the other drop down, the script will automaticall minus 7 days out of the 21 days. I'm able to find the script for this. The script as follows :
var sDate = nForm['dc1'].value;
sDate = sDate.split('-');
sDate = new Date(sDate,sDate-1,sDate)
var eDate = nForm['dc2'].value;
eDate = eDate.split('-');
eDate = new Date(eDate,eDate-1,eDate)
nForm['daysApart'].value = (eDate-sDate)/86400000;
I'm not sure how to modify the script when half days are taken. For example if i take 2.5 days of leave the script must be able calculate that there is 19.5 days of leave left. There will be 2 radio buttons, One called "Full day" the other "Half Day"
dc1 : Textbox (Date selector script)
dc2 : Textbox (Date selector script)
Server side script jsp, Mysql
Thank you so very much for your help. I'm a total newbie. Greatly appreciated.
10-18-2006, 01:41 PM #2
- Join Date
- Oct 2005
- I'm in GMT -5
- Thanked 1 Time in 1 Post
Post the complete form.