Link to home
Start Free TrialLog in
Avatar of hleungta
hleungta

asked on

Java - Date

How do I get the day of the week for a given date ?
Avatar of hleungta
hleungta

ASKER

Edited text of question
ASKER CERTIFIED SOLUTION
Avatar of imladris
imladris
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm using 1.1 therefore don't want to use deprecated functions.
I'm not sure I completely undertand the use of Calendat.get(...)

Maybe I'm going re-explain my problem:
     I have a Date object and want to get the DAY OF WEEK
. how do I use the Calendar class to get this day of week ?

A calendar is created and initialized as follows:

//create a Gregorian Calendar
 Calendar calendar = new GregorianCalendar();

//set calendar time with a Date object
 calendar.setTime(now);

//get day of the week
int i=calendar.get(Calendar.DAY_OF_WEEK);