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.
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
posted
0
thank you for the help, it workdes. But i still can't understand why i couldn't do it that way
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!
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
posted
0
thanx, i think that i understood it. is this name suitable - "andrew"??
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
posted
0
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.