C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Javascript »

how to calculate End date after adding some days to startdate


Posted Date: 04 Nov 2008    Resource Type: Code Snippets    Category: Javascript
Author: AbhayMember Level: Diamond    
Rating: 1 out of 5Points: 5 (Rs 3)



sometimes we need to calculate a date after adding some duration to a date just for example doctor pescribe a medicine for some days so end date will be today + some duration.

we have to do it in clientside in javscript function write these

//USES MASTER PAGE
var startTime = document.getElementById('<%=txtstartDate.ClientID%>').value;//START DATE
var objvalDur = document.getElementById('<%=ddlDuration.ClientID%>').value;//duration

//calculate end date
var d = new Date(startTime);
d.setDate(d.getDate()+durTime);
var exactDate = (d.getMonth()+1)+"/"+d.getDate()+"/"+d.getYear();
document.getElementById('<%=txtendDate.ClientID%>').value=exactDate;




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Start date  .  Javascript  .  End date  .  Add days  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Add selected item of dropdownlist into listbox using javascript
Previous Resource: Access an Element of a html document using TagName
Return to Discussion Resource Index
Post New Resource
Category: Javascript


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use