new DateTime().plusWeeks(1).withDayOfWeek(1);

This technique only works for Monday, since that is the first day of the 
ISO calendar week.

Fernando Wermus wrote:
> Hi all!
>      I am trying to get next monday from current day. This is my code,
>
>         DateTime nextMonday=new 
> Partial().with(DateTimeFieldType.dayOfWeek(), 1).toDateTime(new 
> DateTime());
>
> But this code has a problem,
>
> If it is the last monday of the month, instead of returning the first 
> monday of next month, it returns the monday before. I can write down 
> some "if" to fix my problem, but I imagine it exists a much better 
> solution. Could anyone help me?
>
> Thanks in advance.
>
> -- 
> Fernando Wermus.
>
> www.linkedin.com/in/fernandowermus 
> <http://www.linkedin.com/in/fernandowermus>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables 
> unlimited royalty-free distribution of the report engine 
> for externally facing server and web deployment. 
> http://p.sf.net/sfu/businessobjects
> ------------------------------------------------------------------------
>
> _______________________________________________
> Joda-interest mailing list
> Joda-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>   

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to