File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Date Difference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Date Difference" Watch "Date Difference" New topic
Author

Date Difference

rose hegde
Ranch Hand

Joined: Oct 22, 2003
Posts: 40
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

Joined: Aug 19, 2003
Posts: 182
Hi..
I am posting a code which will be helpful to yu..If ne queries behind these code feel free to ask...

regards,
Nischal


Thnx
rose hegde
Ranch Hand

Joined: Oct 22, 2003
Posts: 40
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

Joined: Aug 19, 2003
Posts: 182

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

Joined: Oct 22, 2003
Posts: 40
Thanx a lot.
rose hegde
Ranch Hand

Joined: Oct 22, 2003
Posts: 40
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

Joined: Jan 10, 2002
Posts: 61588
    
  67

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6

See if this helps
Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Date Difference