aspose file tools*
The moose likes Beginning Java and the fly likes No.of SUNDAY's between two dates??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "No.of SUNDAY Watch "No.of SUNDAY New topic
Author

No.of SUNDAY's between two dates???

Swapna Agarwal
Ranch Hand

Joined: Jan 30, 2004
Posts: 37
Hi,
Could any one tell me a simple logic to get No.of DAY's between 2 dates?
Example:
Start date:22/03/04
EndDate: 22/03/03
I want to get No. of SUNDAY's between these two dates.
Could any one tell me simple logic?
Thanks
--swapna
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30752
    
156

Swapna,
Take a look at the Calendar class. It can give you the day of the week for each of your two dates. From there, you can calculate the number of sundays.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

This is not a Servlet question, I'll move it to Java in General (beginnner) for you.
Dave.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: No.of SUNDAY's between two dates???