Example usage for org.joda.time Interval getStart

List of usage examples for org.joda.time Interval getStart

Introduction

In this page you can find the example usage for org.joda.time Interval getStart.

Prototype

public DateTime getStart() 

Source Link

Document

Gets the start of this time interval, which is inclusive, as a DateTime.

Usage

From source file:windows.Recursos.java

public static int getActualweek() {
    //        SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy");
    DateTime d = new DateTime();
    Period weekPeriod = new Period().withWeeks(1);
    DateTime startDate = new DateTime(d.getYear(), 1, 1, 0, 0, 0, 0);
    while (startDate.getDayOfWeek() != DateTimeConstants.MONDAY) {
        startDate = startDate.plusDays(1);
    }//  w ww  .j a  v  a  2  s  .  c  o  m

    DateTime endDate = new DateTime(d);
    Interval i = new Interval(startDate, weekPeriod);
    int ct = 0;
    while (i.getStart().isBefore(endDate)) {

        i = new Interval(i.getStart().plus(weekPeriod), weekPeriod);
        ct++;
    }
    return ct;
}