There is no support in Joda-Time for this. I would use LocalDate
rather than DateTime.

If you need to be more efficient, you could implement the List
interface directly creating the list on the fly using an iterator.

Stephen


On 15 October 2010 08:49,  <m...@mherrn.de> wrote:
> Hi,
>
> I need to get a list of full days from an interval. For example, from the
> interval 2010-10-14 - 2010-10-16, I want to get a list with the DateTime
> objects for 2010-10-14, 2010-10-15 and 2010-10-16.
> I have done it this way:
>
>    public static List<DateTime> getDaysInInterval(final Interval interval){
>        final DateTime start= interval.getStart().dayOfMonth().getDateTime();
>        final DateTime end= interval.getEnd().dayOfMonth().getDateTime();
>
>        final List<DateTime> days= new
> ArrayList<DateTime>(Days.daysBetween(start, end).getDays());
>
>        for (DateTime day=start; day.isBefore(end); day= day.plusDays(1)){
>            days.add(day);
>        }
>        days.add(end);
>
>        return days;
>    }
>
> But I am wondering if there is a more efficient way. Something joda-time
> already provides and I may have just overlooked. (And as I now while I am
> writing this, the above may not even be very correct.)
>
> Regards
> Marco
>
>
>
> ------------------------------------------------------------------------------
> Download new Adobe(R) Flash(R) Builder(TM) 4
> The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
> Flex(R) Builder(TM)) enable the development of rich applications that run
> across multiple browsers and platforms. Download your free trials today!
> http://p.sf.net/sfu/adobe-dev2dev
> _______________________________________________
> Joda-interest mailing list
> Joda-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to