Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
nhsoft.xy@gmail.com - 16 Apr 2006 08:32 GMT
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()
Bjorn Abelli - 16 Apr 2006 11:31 GMT
<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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.