Number Of Weeks

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Number Of Weeks

Michael Szediwy
Hi,

what is the best way to compute the number of weeks in a month?
Or say the 3rd week of October etc.

Thanks in advance for your answer.

Regards

Michael

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Number Of Weeks

Mark Carroll
Michael Szediwy wrote:

> what is the best way to compute the number of weeks in a month?

Something with Weeks.weeksBetween or weeksIn or standardWeeksIn or
whatever, setting the month with LocalDate's
dayOfMonth().withMinimumValue() and withMaximumValue() or something may
work well. Especially with a ReadablePartial notice if the end of the
interval is included or excluded -- I can't remember if intervals are
usually treated as being half-open.

> Or say the 3rd week of October etc.

So, also notice methods like plusWeeks.

I hope my quick hints get you far enough along. (-:

Mark

--
Mark Carroll
Software Engineer
[hidden email]
http://www.vecna.com/

Cambridge Research Laboratory
Vecna Technologies, Inc.
36 Cambridge Park Drive
Cambridge, MA 02140
Phone: (617) 864-0636
Fax: (617) 864-0638

Better Technology, Better World (TM)

The contents of this message may be privileged and confidential.
Therefore, if this message has been received in error, please delete it
without reading it. Your receipt of this message is not intended to
waive any applicable privilege. Please do not disseminate this message
without the permission of the author.

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Number Of Weeks

jodastephen
In reply to this post by Michael Szediwy
You can obtain the length of a month from the DateTimeField.

You can calculate the number of weeks in a month, or which week it is
by simple maths from DayOfMonth.

week = ((dom - 1) / 7) + 1;

Stephen


On 19 October 2011 13:09, Michael Szediwy <[hidden email]> wrote:

> Hi,
>
> what is the best way to compute the number of weeks in a month?
> Or say the 3rd week of October etc.
>
> Thanks in advance for your answer.
>
> Regards
>
> Michael
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2d-oct
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Loading...