Forums Register Login

how do i get day of the week from the date

+Pie Number of slices to send: Send
hi all,
i want to get the day of the week for a particular date.
assume the date is in the dd/mm/yyyy format
then in java how can i display the day for this date
for example..for 06/08/2002 i want Tue to be the output.
Please help.
thanx in advance
Chhaya
+Pie Number of slices to send: Send
there is no easy way about it and it involves alot of validating u will have to create a table of the days of the week get the system date and then u also have to create the days of the week in num it's quite complicated i hope this little piece helps
+Pie Number of slices to send: Send
You can use Calendar API to get the day of the week.Let's say the date is 6th Aug 2002.Set the calendar object as following:
cal.set(2002,7,6);
where - 2002 is the year
7 - month (Jan is 0 so Aug is 7)
6 - date

Output :
Day is 3
which is TUESDAY
(SUNDAY -1,MONDAY - 2 and so on)
+Pie Number of slices to send: Send
 

Originally posted by Chhaya Dhanani:
hi all,
i want to get the day of the week for a particular date.
assume the date is in the dd/mm/yyyy format
then in java how can i display the day for this date
for example..for 06/08/2002 i want Tue to be the output.
Please help.
thanx in advance
Chhaya

I don't think that this is too hard using the java.text.SimpleDateFormat class:

Jamie
The first person to drink cow's milk. That started off as a dare from this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 27085 times.
Similar Threads
how to caculate first day / last day of a week ?
date problem
first day of the current week
date question
How to get day, month, and year seperate from date
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 02:14:39.