Solved

# Sunday in a month

Posted on 2006-07-06
237 Views
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
Question by:richard234
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2
• 2

LVL 8

Accepted Solution

thomas908 earned 84 total points
ID: 17056364
0

LVL 2

Assisted Solution

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

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

ID: 17093079
hi richard,

have u all ready identified the solution

regards,
vikrant
0

LVL 5

Assisted Solution

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

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

Mukta.
0

## Featured Post

Question has a verified solution.

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

### Suggested Solutions

Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
Simple Linear Regression
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
###### Suggested Courses
Course of the Month4 days, 18 hours left to enroll