# First day of the first week of the month

Nestor Alduey
Greenhorn
Posts: 26
Hello,

I wanna know how can I determine the first day of the first week in any month.
For example the first day in JAN/2007 is the 2(Monday) cause it's the first day of the week, in that start a new Month...

N�stor Alduey
SCJP 1.4

Keith Lynn
Ranch Hand
Posts: 2409
I'm a little confused with your question. Do you mean what day of the month is the first Monday?

There are methods in the Calendar class that allow you to specify a month, year, day, etc.

From that you should be able to find on what day the first of the month is.

Paul Clapham
Sheriff
Posts: 21443
33
You should really clarify what you want. It's hard to understand "the first day of the first week of a month". Let's take an example: May 2007.

The first week of May 2007 is... well, it depends if you start your weeks on Sunday or on Monday. Let's suppose Monday. Then the first week of May 2007 is the one starting on April 30 and ending on May 6. And the first day of that week is April 30.

This is all based on the standard way that Calendar defines those terms, and that in turn is based on standards published by the ISO. But is it what you want? It's quite common for people to have their own ideas of what things like "first week of a month" mean regardless of any international standards.

In fact it's quite common for people to miss the fact that the weeks don't fit into the months. I've had people ask for sales reports by week within month, and when I ask them what to do about the weeks that span month-end they haven't a clue what they really wanted.

Nestor Alduey
Greenhorn
Posts: 26
You that when a month start not is necesary that the month start's in the first day of the week. For that it could be that the april/01/2007 starts one monday or it could be that starts one webnesday or friday... I want a funtion that I give the month and the year and it give me the day that the month starts...
Thanks!!!

Keith Lynn
Ranch Hand
Posts: 2409
Look at the API for Calendar.

In particular look at the get method and the set method.

Paul Clapham
Sheriff
Posts: 21443
33
Originally posted by Nestor Alduey:
I want a funtion that I give the month and the year and it give me the day that the month starts...
So in other words, you just want the first day of the month?

Nestor Alduey
Greenhorn
Posts: 26
The day of the week when starts the month...

Paul Clapham
Sheriff
Posts: 21443
33
Originally posted by Nestor Alduey:
The day of the week when starts the month...
Okay. So given May 2007, you want to know that the first day of that month is a Tuesday, for example?

Rene Larsen
Ranch Hand
Posts: 1179
The day of the week when starts the month...

Originally posted by Nestor Alduey:
Hello,

I wanna know how can I determine the first day of the first week in any month.
For example the first day in JAN/2007 is the 2(Monday) cause it's the first day of the week, in that start a new Month...

N�stor Alduey
SCJP 1.4

I don't understand why you then want that JAN/2007 should start on the first day of the week in this Month? - depends if you start your weeks on Sunday or on Monday.
[ April 14, 2007: Message edited by: Rene Larsen ]

Andrei Matyas
Greenhorn
Posts: 25
This should do what you need