Solved

java.util.Date deprecated methods

Posted on 2003-10-26
1
955 Views
Last Modified: 2012-05-04
java.util.Date object methods are mostly deprecated.
let say i want to get year of a date object, how to do it, without using deprecated method getYear()?
0
Comment
Question by:kokshong
1 Comment
 
LVL 2

Accepted Solution

by:
f_98 earned 50 total points
ID: 9622680
http://java.sun.com/j2se/1.4.1/docs/api/java/util/Calendar.html

use the calendar object, something like;


Date myDate = new Date();
Calendar cal = Calendar.getInstance();
cal.setTime(myDate);
int year = cal.get(Calendar.YEAR);


0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
triangle challenge 4 77
array11 challenge 16 51
mapBully challenge 6 89
mapAB Challlenge 35 85
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now