Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 246
  • Last Modified:

Sunday in a month

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
richard234
Asked:
richard234
  • 2
  • 2
3 Solutions
 
vikrant4u2Commented:
hi richard,

try this

cal.get(cal.DAY_OF_WEEK_IN_MONTH )

regards,
vikrant
0
 
muktajindalCommented:
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
 
vikrant4u2Commented:
hi richard,

have u all ready identified the solution

regards,
vikrant
0
 
muktajindalCommented:
Shorten it as:

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

Mukta.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now