aspose file tools*
The moose likes Java in General and the fly likes First day of the first week of the month Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "First day of the first week of the month" Watch "First day of the first week of the month" New topic
Author

First day of the first week of the month

Nestor Alduey
Greenhorn

Joined: Jul 30, 2006
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...
I need your helps!!!

N�stor Alduey
SCJP 1.4
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Jul 30, 2006
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

Joined: Feb 07, 2005
Posts: 2367
Look at the API for Calendar.

In particular look at the get method and the set method.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Jul 30, 2006
Posts: 26
The day of the week when starts the month...
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Oct 12, 2001
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...
I need your helps!!!

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 ]

Regards, Rene Larsen
Dropbox Invite
Andrei Matyas
Greenhorn

Joined: Apr 15, 2007
Posts: 25
This should do what you need


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: First day of the first week of the month