codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  calculating date using javascript  supriyapelluru at 16:38 on Friday, April 11, 2008
 

Hi to all


i am new to this forum . i want code for one particular issue that is related to date . think that we have two text fields

in one text field we selecting the date. this is using for

selecting a book from library .here user is selecting a book for

that user mentioning the selected date based on that date .

automatically in second field that is returning date field has to

field with after two weeks date . that means based on the user

selected date automatically returning date has to displayed in

returning date field where if user select a selecting date as

11-april-2008 then returning date automatically displayed in

return date test field as 24-april-2008 . this type of

calucations has to done in java script and displayed in

returning date text field. if any one know about this problem or

any one have code for this please reply me . it is urgent for me .plz give me reply .

  Re: calculating date using javascript  MattoThePotatto at 08:52 on Wednesday, June 25, 2008
 

<script type="text/javascript">
var date = new Date();
var month = date.getMonth()+1;
var today = date.getDate();
var returnDay = date.getDate()+14;
var returnMonth = month;
if(returnDay>31)
{
returnDay -=31;
var returnMonth = month+=1;
}
var todayIs = today + ":" + month;
var returnBy = returnDay + ":" + returnMonth;
document.getElementById('issuedate').setAttribute('value',todayIs);
document.getElementById('returndate').setAttribute('value',returnBy);
</script>
<input type="text" id="issuedate" />
<input type="text" id="returndate" />



The above code should return both dates ... Todays date, what ever it may be .. And a date 2 weeks from now.








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: Help Running VB script in Windows 2003
•  ONUNLOAD
•  Re: Insert Contents of .txt file into a .html page
•  Re: Perl regular expression problem.
•  Re: Problems in login using WWW::Mechanize
•  searching for gd::graph guide
•  Re: ARRAY OF HASHMAPS
•  Adv. Regexp or Otherwise
•  Adv. Regexp or Otherwise


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008