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
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
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)
Snigdha<br />Sun Certified Programmer for the Java™ 2 Platform
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
If you believe you can tell me what to think, I believe I can tell you where to go. Go read this tiny ad!