Problem with JavaScript Date process
-
I want todays date in one textbox and in another textbox 15days incremented i have a Javascript code for getting date month Year function addDate() { TheDate = new Date(); var theMonth = TheDate.getMonth(); var theDay = TheDate.getDate(); var theYear = TheDate.getFullYear(); if (document.getElementById('Text1').value == '') { document.getElementById('Text1').value = theDay + '/' + theMonth + '/' + theYear ; } else { document.getElementById('Text1').value = theDay + '/' + theMonth + '/' + theYear ; } } I am unable to increment the date in second textbox help me to solve this problem.:confused:</x-turndown>
-
I want todays date in one textbox and in another textbox 15days incremented i have a Javascript code for getting date month Year function addDate() { TheDate = new Date(); var theMonth = TheDate.getMonth(); var theDay = TheDate.getDate(); var theYear = TheDate.getFullYear(); if (document.getElementById('Text1').value == '') { document.getElementById('Text1').value = theDay + '/' + theMonth + '/' + theYear ; } else { document.getElementById('Text1').value = theDay + '/' + theMonth + '/' + theYear ; } } I am unable to increment the date in second textbox help me to solve this problem.:confused:</x-turndown>
kiranreddy wrote:
help me to solve this problem
You did not tell us your problem. Also this suspiciously looks like web stuff and not C#, try the ASP.NET forum.
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 beta 1 - out now!
((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x)) -
I want todays date in one textbox and in another textbox 15days incremented i have a Javascript code for getting date month Year function addDate() { TheDate = new Date(); var theMonth = TheDate.getMonth(); var theDay = TheDate.getDate(); var theYear = TheDate.getFullYear(); if (document.getElementById('Text1').value == '') { document.getElementById('Text1').value = theDay + '/' + theMonth + '/' + theYear ; } else { document.getElementById('Text1').value = theDay + '/' + theMonth + '/' + theYear ; } } I am unable to increment the date in second textbox help me to solve this problem.:confused:</x-turndown>
Use the getTime method to get the date in milliseconds, add the number of milliseconds in 15 days, and create a new Date object from the result. Note that the month value is zero based, so you have to add one to get the one based value that humans use.
Despite everything, the person most likely to be fooling you next is yourself.