• Post Reply Bookmark Topic Watch Topic
  • New Topic

How display the weeks of the month?  RSS feed

 
Roberto Tucci
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,
I'm trying to calculate the weeks of the month but I'm very confused how can I do... (I'm using JodaTime)

I considered, for example, current month (variable in input):



I would like see in output this result (based on Local date, possibly):

1 week: 03-30-2014 --- 04-05-2014
2 week: 04-06-2014 --- 04-12-2014
3 week: 04-13-2014 --- 04-19-2014
4 week: 04-20-2014 --- 04-26-2014
5 week: 04-27-2014 --- 05-03-2014

How can I do?? :-S

Thanks!!!
 
Todd Placher
Greenhorn
Posts: 6
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm... since this doesn't provide too much info like code, I'll provide some hints to allow you to build it up.

You can try to take a look at this page: http://joda-time.sourceforge.net/userguide.html

for your formatted output I would look specifically at the Freaky Formatter section

for your local time look at the Changing Time Zone section for example to get the local date just:

// get current moment in default time zone
DateTime dt = new DateTime();

which is going to give you all this:
The DateTime implementation provides a complete list of standard calendar fields:
dt.getEra();
dt.getYear();
dt.getWeekyear();
dt.getCenturyOfEra();
dt.getYearOfEra();
dt.getYearOfCentury();
dt.getMonthOfYear();
dt.getWeekOfWeekyear();
dt.getDayOfYear();
dt.getDayOfMonth();
dt.getDayOfWeek();
 
Roberto Tucci
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply!
I've fixed my problem as is:



Thanks!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!