creating Date objects

J

jimgardener

for running a sample program in sun's java tutorial(Employee program
in Comparators section of object ordering) i need to create some Date
objects with diff values for year ,month,day etc.Since Date(int year,
int month,int day) is deprecated i can't use new Date(2001,02,23) to
create a Date instance.How should i go about this?.can someone help?
jim
 
J

jimgardener

read the rest of the
Javadoc for the deprecated constructor, the part that begins
"replaced by ..."

sorry Eric...I need Date objects. i can't figure out how to get that
from a Calendar instance..
jim
 
J

jimgardener

read the rest of the
Javadoc for the deprecated constructor, the part that begins
"replaced by ..."

sorry about that..my mistakes!!shd have read carefully
jim
 
R

Roedy Green

for running a sample program in sun's java tutorial(Employee program
in Comparators section of object ordering) i need to create some Date
objects with diff values for year ,month,day etc.Since Date(int year,
int month,int day) is deprecated i can't use new Date(2001,02,23) to
create a Date instance.How should i go about this?.can someone help?
jim

Date itself is pretty well deprecated. The tutorial is probably old,
so just go ahead and use new Date.
 
J

John B. Matthews

jimgardener said:
read the rest of the

sorry Eric...I need Date objects. i can't figure out how to get that
from a Calendar instance..
jim

Doesn't Calendar's getTime() return a Date?

"God marks time from the epoch; all else is the work of Sun." --with
apologies to Kronecker ;-)

John
 
A

Arne Vajhøj

Roedy said:
Date itself is pretty well deprecated. The tutorial is probably old,
so just go ahead and use new Date.

Date is still absolutely necessary.

Only the stuff replaced by (Gregorian)Calendar is deprecated.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top