tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yansheng Lin" <>
Subject RE: [OT] The Way Java Handles Date
Date Fri, 02 Apr 2004 19:44:32 GMT
As I said, this is a faq.  There is already tutorials on Sun's Website.  But the
way it works now is kind of counter-intuitive.  That's the problem to new user.
Wouldn't it be nicer if Sun came up with an Wrapper interface that allows the
user create a Date object with different arguments?   

import java.util.Date;
import java.text.ParseException;

public class MyClass {
  private final static DateFormat fmt = new SimpleDateFormat("dd/MM/yyyy");

  public Date convert(String str) {
    try {
      Date date = fmt.parse(str);
      return date;
    catch (ParseException pe) {
      System.out.println("The string does not contain a date in the expected
      return null;


-----Original Message-----
From: Rhino [] 
Sent: Friday, April 02, 2004 11:26 AM
To: Tomcat Users List
Subject: Re: [OT] The Way Java Handles Date

I agree. I found date manipulation a real pain when I first started using

On the other hand, I know how to work with them now and I'm not prepared to
write anything better than the existing Java date/calendar classes so I can
live with it now.

I think a short tutorial is probably the best answer for explaining this to
people who are new to date manipulation in Java but I'm too busy with other
things to write one myself, at least for the next few weeks.

Maybe you could write a tutorial as you learn what you need to know?


----- Original Message ----- 
From: "Yansheng Lin" <>
To: "'Tomcat Users List'" <>
Sent: Friday, April 02, 2004 11:47 AM
Subject: [OT] The Way Java Handles Date

Hi, Just wondering if anyone found this aspect of Java annoying.  I know
this is
usually a faq, and a lot of people have put a lot of efforts making it
But I just find that the learning curve is a bit too steep for new comers.
it hasn't been improve in j2sdk-1.5 either, at least from the interface
point of
view.  For example, a developer still has to go through the whole Calendar
DateFormat process to get a Date from a String....

I feel like complaining today:).


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message