Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Why so many methods deprecated in java.util.Date.

Reply
Thread Tools

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

 
 
nhsoft.xy@gmail.com
Guest
Posts: n/a
 
      04-16-2006
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()

 
Reply With Quote
 
 
 
 
Bjorn Abelli
Guest
Posts: n/a
 
      04-16-2006

<(E-Mail Removed)> 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/...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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
logging: warn() methods and function to be deprecated. Vinay Sajip Python 0 10-22-2011 12:09 PM
Basic Question re JUnit Tests and Deprecated Methods Rhino Java 3 05-19-2010 12:43 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Deprecated methods: how important to fix? kaeli Java 3 08-24-2004 08:20 PM
Deprecated warnings within deprecated code Barney Barumba Java 0 07-23-2003 12:46 AM



Advertisments