User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 402,372 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,068 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1207 | Replies: 0
Reply
Join Date: Oct 2006
Posts: 15
Reputation: shaun09 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
shaun09 shaun09 is offline Offline
Newbie Poster

Help Unsure how to handle advance date calculations

  #1  
Oct 17th, 2006
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 :

<script type="text/javascript">

function checkDate(nForm){

var sDate = nForm['dc1'].value;
sDate = sDate.split('-');
sDate = new Date(sDate[2],sDate[1]-1,sDate[0])
var eDate = nForm['dc2'].value;
eDate = eDate.split('-');
eDate = new Date(eDate[2],eDate[1]-1,eDate[0])
nForm['daysApart'].value = (eDate-sDate)/86400000;
nForm['hiddenElmName'].value=nForm['daysApart'].value
alert(nForm['daysApart'].value);

return true;
}

</script>

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.
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 12:21 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC