aspose file tools*
The moose likes Beginning Java and the fly likes Date Conversion... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Date Conversion..." Watch "Date Conversion..." New topic
Author

Date Conversion...

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Could anyone help me on this, i am trying to get the difference between the system date and the date i have stored as a String object("12-Aug-99"). I am using Calendar class to get the current date.
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20580
    ∞

Since this doesn't seem to have anything to do with certification, I'm gonna move this to the Java in General (beginner) forum so more people might be able to answer it.

permaculture Wood Burning Stoves 2.0 - 4-DVD set
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20580
    ∞

Because the built in Date classes have some issues, I made my own date handling classes. See www.javaranch.com/common.html. Look for GDate and JDate.
String s = "1999-08-12"; // aug 12, 99
int todayInt = new JDate( new GDate() ).get();
int prevInt = new JDate( new GDate( s ) ).get();
int diff = todayInt - prevInt ;
I hope this helps.
[This message has been edited by Marilyn deQueiroz (edited September 26, 2001).]
Ronald Whalen
Ranch Hand

Joined: Mar 27, 2001
Posts: 38
Paul,
I tried your link but it was not found. Your classes sound like just what I need. Is there another link?

Ronald
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Ronald. Remove the . at the end of the address.
Ivan Tamayo
Ranch Hand

Joined: Aug 13, 2001
Posts: 49
You may use GregorianCalendar.
Art Metzer
Ranch Hand

Joined: Oct 31, 2000
Posts: 241
Try something like this:

Good luck to you,
Art
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Date Conversion...