File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Date issues! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Date issues!" Watch "Date issues!" New topic

Date issues!

bob connolly
Ranch Hand

Joined: Mar 10, 2004
Posts: 204

I just found this resolution for a a Date issue that i'm having, Thanks very much!, but assume that Sun has resolved their lack of Date handling routines by now?

If not, i'm totally shocked!, but again assume there must be a good reason?

A SAS tool that i use has a myriad of Date handling routines and documentation!

Thanks much for any insights on this!
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

I'm unable to determine if you have a question. What insights are you looking for?

Calculating Java dates: Take the time to learn how to create and use dates
Working in Java time: Learn the basics of calculating elapsed time in Java
bob connolly
Ranch Hand

Joined: Mar 10, 2004
Posts: 204
Thanks Steve!

I quess i'm really suprised that Sun has made the Date handling so confusing, ie what ever happened to the good ole "d.getMonth" ect!

I've been trying to get this to work all morning to no avail, do you see anything obvious Steve?

$ ksh t.ksh
Note: uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
1. Wed Sep 21 04:24:54 EDT 2005
ERROR: Cannot parse "Wed Sep 21 04:24:54 EDT 2005"

String ldt= new String("Wed Sep 21 04:24:54 EDT 2005");
Date dto= new Date(ldt);

String dateString = dto.toString();
System.out.println(" 1. " + dateString);

SimpleDateFormat format = new SimpleDateFormat("yyMMdd");

try {
Date parsed = format.parse(dateString);
System.out.println(" 2. " + parsed.toString());
catch(ParseException pe) {
System.out.println("ERROR: Cannot parse \"" + dateString + "\"");

Thanks for any inputs on this Steve!
I agree. Here's the link:
subject: Date issues!
jQuery in Action, 3rd edition