Results 1 to 6 of 6
- 07-20-2010, 06:43 AM #1
Member
- Join Date
- Apr 2010
- Posts
- 19
- Rep Power
- 0
check the sunday and saturday from a given date range
Hi all,
i have a requirement that from a given date range i should count the number of days and i should not count the sunday and saturday from the date range. please help me on this. and i want to check the start date should be less than end date. please help me on this...... if you have any code please share it with me. i would be really helpfull.
regards,
harsha
- 07-20-2010, 07:06 AM #2
Member
- Join Date
- Jun 2010
- Location
- Bangalore,India
- Posts
- 70
- Rep Power
- 0
Write a method which takes fromdate and todate as arguements and by the help of Calendar class you can count the days without including saturday and sunday..
Arun K R,Bangalore,India
:)
- 07-20-2010, 07:35 AM #3
Member
- Join Date
- Apr 2010
- Posts
- 19
- Rep Power
- 0
check the sunday and saturday from a given date range
hi arun,
if you know the code can you please share with me please.... harsha.udupa2002@gmail.com is my email id.
regards,
harsha
- 07-20-2010, 07:52 AM #4
Member
- Join Date
- Jun 2010
- Location
- Bangalore,India
- Posts
- 70
- Rep Power
- 0
Find the number of days between the dates ,
Find the number of saturdays and sundays in between
The difference will give you the exact number of days..
Refer the following code which will help you in writing the method..
Java Code:import java.util.*; public class FirstDayOfWeek{ public static void main(String[] args) { GregorianCalendar gcal = new GregorianCalendar(); int week = gcal.getActualMaximum(Calendar.DAY_OF_WEEK); System.out.println("Day of week: " + week); int first = gcal.getFirstDayOfWeek() ; switch(first){ case 1: System.out.println("Sunday"); break; case 2: System.out.println("Monday"); case 3: System.out.println("Tuesday"); case 4: System.out.println("Wednesday"); case 5: System.out.println("Thrusday"); case 6: System.out.println("Friday"); case 7: System.out.println("Saturday"); } } }Arun K R,Bangalore,India
:)
- 07-20-2010, 07:57 AM #5
Member
- Join Date
- Jun 2010
- Location
- Bangalore,India
- Posts
- 70
- Rep Power
- 0
Refer the following link which will help you
Calculating the Number of Days Between Two Dates in java - Q&AArun K R,Bangalore,India
:)
- 07-20-2010, 08:22 AM #6
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Similar Threads
-
jField date range
By JavaTrouble in forum New To JavaReplies: 5Last Post: 05-25-2010, 04:40 AM -
Getting the next saturday or sunday from a given date
By sbekele in forum New To JavaReplies: 3Last Post: 01-27-2010, 06:12 PM -
Compare date input to database with current date
By hungleon88 in forum Advanced JavaReplies: 2Last Post: 11-25-2008, 08:10 AM -
Tech Career Fair - eHarmony - Saturday - Sept 27th
By Volt Recruiter in forum Jobs OfferedReplies: 0Last Post: 09-25-2008, 12:49 AM -
Creating a Gregorian Calendar using a Date object gives date - 1
By prachi_goliwadekar in forum New To JavaReplies: 1Last Post: 05-08-2008, 08:32 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks