aspose file tools*
The moose likes Beginning Java and the fly likes class java.util.Date ...... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "class java.util.Date ......" Watch "class java.util.Date ......" New topic
Author

class java.util.Date ......

Andrew Lit
Ranch Hand

Joined: Jul 01, 2002
Posts: 135
this class has been deprecated here:
int day = d.getDay();
and i can't understand why. Could someone explain me pls.
i use jdk 1.3.1
i would be appreciated for the help. Sorry for my english.
Stu Glassman
Ranch Hand

Joined: Jul 01, 2002
Posts: 91
Have a look at the java.util.Calendar class.
First, you need an instance of Calendar:
Calendar cal = Calendar.getInstance();
Then, you use the get method. Use one of the constants from Calendar for the parameter. For example:
cal.get(Calendar.DATE);
Hope this works,
-Stu
Andrew Lit
Ranch Hand

Joined: Jul 01, 2002
Posts: 135
thank you for the help, it workdes. But i still can't understand why i couldn't do it that way
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
anru,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
A good place to look for an explanation of why and how a class functions is in The Java 2 API Documentation. The java.util.Date Documentation does not say that the class Date is deprecated, but many of its methods (and constructors) are deprecated. The first two paragraphs of the documentation for Date describe what the class should be used for and why many of its methods have been deprecated:
The class Date represents a specific instant in time, with millisecond precision.
Prior to JDK 1.1, the class Date had two additional functions. It allowed the interpretation of dates as year, month, day, hour, minute, and second values. It also allowed the formatting and parsing of date strings. Unfortunately, the API for these functions was not amenable to internationalization. As of JDK 1.1, the Calendar class should be used to convert between dates and time fields and the DateFormat class should be used to format and parse date strings. The corresponding methods in Date are deprecated.

[ July 02, 2002: Message edited by: Dirk Schreckmann ]
Andrew Lit
Ranch Hand

Joined: Jul 01, 2002
Posts: 135
thanx, i think that i understood it.
is this name suitable - "andrew"??
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
Andrew,
You need two names separated by a space. For example, "Andrew Smith" or "Anru Depra"


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
thanx, i think that i understood it.
You're welcome and great.
is this name suitable - "andrew"??
No. As stated in The JavaRanch Naming Policy, we request that your display name have three parts - a first name or initial, a space, and a last name.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: class java.util.Date ......