Solved

Sunday in a month

Posted on 2006-07-06
7
235 Views
Last Modified: 2010-04-01
I have some site which lists various activites for each Sunday. Activities differ from one sunday to another. So I need to find out that the Sunday is whcih Sunday of the month, first or second etc.
I am using Calender class, but don't know how to do it.
0
Comment
Question by:richard234
  • 2
  • 2
7 Comments
 
LVL 8

Accepted Solution

by:
thomas908 earned 84 total points
ID: 17056364
0
 
LVL 2

Assisted Solution

by:vikrant4u2
vikrant4u2 earned 83 total points
ID: 17056661
hi richard,

try this

cal.get(cal.DAY_OF_WEEK_IN_MONTH )

regards,
vikrant
0
 
LVL 5

Expert Comment

by:muktajindal
ID: 17071913
If you are having date, you can do try solving it manually as follows:

if (date%7 == 0)
    sundayNum = (date/7);
else
    sundayNum = (date/7) + 1;

0
 
LVL 2

Expert Comment

by:vikrant4u2
ID: 17093079
hi richard,

have u all ready identified the solution

regards,
vikrant
0
 
LVL 5

Assisted Solution

by:muktajindal
muktajindal earned 83 total points
ID: 17096618
Shorten it as:

sundayNum = (date%7 == 0)?(date/7):(date/7) + 1;

Mukta.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
maven project import to eclipse problems 13 105
jersey maven project error 7 141
dateFashion java challenge 9 140
equalIsNot  challenge 43 143
When we purchase storage, we typically are advertised storage of 500GB, 1TB, 2TB and so on. However, when you actually install it into your computer, your 500GB HDD will actually show up as 465GB. Why? It has to do with the way people and computers…
Data breaches are on the rise, and companies are preparing by boosting their cybersecurity budgets. According to the Cybersecurity Market Report (http://www.cybersecurityventures.com/cybersecurity-market-report), worldwide spending on cybersecurity …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question