Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Date Difference

 
rose hegde
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 3 text fields.
Through date picker i insert start date in one text field and end date in another text field.
I want to know how do display the difference of these 2 dates in form of days in the third text field.
Can anyone help?
Thanx
 
Nischal Tanna
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..
I am posting a code which will be helpful to yu..If ne queries behind these code feel free to ask...

regards,
Nischal
 
rose hegde
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have code in jsp file like this..
-----------------------------

input id="txtstartdate" type="text" name="txtstartdate" size="12"

input id="txtenddate" type="text" name="txtenddate" size="12"
input id="txtndays" type="text" name="txtndays" size="7" ------------------------------------
Now thru date picker i get start date and end date....
And the difference of the days between these 2 dates should be displayed in the third text field.
Thanx
 
Nischal Tanna
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I hope this helps u...I have used SimpleDateFormat to parse the given String into a date object and the rest is same..U will have to restrict the user to insert date in s scpecific format..This can b done through javascript..
regards,
Nischal
 
rose hegde
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx a lot.
 
rose hegde
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually i want to find difference of 2 dates in frontend..javascript..!!
And when i enter start date and end date through date picker..on jsp page..than automatically the 3rd field should be displayed with no of days between the dates..
Thanx
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually i want to find difference of 2 dates in frontend..javascript..!!

In that case I'm going to shuffle this off the HTML/Javascript forum.
bear
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

See if this helps
Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic