f



Why so many methods deprecated in java.util.Date.

eg.
    /**
     * Returns the day of the month represented by this <tt>Date</tt>
object.
     * The value returned is between <code>1</code> and <code>31</code>

     * representing the day of the month that contains or begins with
the
     * instant in time represented by this <tt>Date</tt> object, as
     * interpreted in the local time zone.
     *
     * @return  the day of the month represented by this date.
     * @see     java.util.Calendar
     * @deprecated As of JDK version 1.1,
     * replaced by <code>Calendar.get(Calendar.DAY_OF_MONTH)</code>.
     * @deprecated
     */
    @Deprecated
    public int getDate() {
	return normalize().getDayOfMonth();
    }

Why, I think Calendar.get(Calendar.DAY_OF_MONTH) is more ugly then
Date.getDate()

0
nhsoft.xy (1)
4/16/2006 7:32:35 AM
comp.lang.java.programmer 52714 articles. 1 followers. Post Follow

1 Replies
400 Views

Similar Articles

[PageSpeed] 44

<nhsoft.xy@gmail.com> wrote...

> Why, I think Calendar.get(Calendar.DAY_OF_MONTH) is more ugly
> then Date.getDate()

You'll find one explanation in the JDK:

  "The class Date represents a specific instant in time,
   with millisecond precision.

   Prior to JDK 1.1, the class Date had two additional functions.
   /.../ Unfortunately, the API for these functions was not amenable
   to internationalization. /.../"

http://java.sun.com/j2se/1.5.0/docs/api/java/util/Date.html

So, instead of trying to "fix" the Date-class, they provided the new 
Calendar-classes, and deprecated the corresponding methods in Date.

The Date class is now to be considered only as a Holder for that millisecond 
in time, which in different TimeZones mean different local times.

As such it's still useful as e.g. the superclass of java.sql.Date, 
java.sql.Time, java.sql.Timestamp.


// Bjorn A


0
bjorn_abelli (300)
4/16/2006 10:31:17 AM
Reply: