Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Sunday in a month

Posted on 2006-07-06
7
Medium Priority
?
243 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 336 total points
ID: 17056364
0
 
LVL 2

Assisted Solution

by:vikrant4u2
vikrant4u2 earned 332 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 332 total points
ID: 17096618
Shorten it as:

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

Mukta.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

972 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