 <p>You need to specify your definition of a week. </p> <h1>String Representation Of A Year-Week</h1> <p>One option is strings. The ISO 8601 standard <a href="https://en.wikipedia.org/wiki/ISO_week_date" rel="nofollow">defines a week</a> as beginning on a Monday, ending on Sunday, with the first week of the year being the first to contain a Thursday, resulting in 52 or 53 weeks a year. </p> <p>The standard also defines a string <a href="https://en.wikipedia.org/wiki/ISO_8601#Week_dates" rel="nofollow">representation for this week-of-year</a> span of time in the format of <code>YYYY-Www</code> (or omitting hypen, <code>YYYYWww</code>) such as <code>2014-W07</code>. A day within the week is represented by a digit where Monday is 1 and Sunday is 7, in the format <code>YYYY-Www-D</code> (or omitting hyphen, <code>YYYYWwwD</code>) such as <code>2014-W07-2</code> (a Tuesday in 7th week of year). The <code>W</code> is important to disambiguate from a year-month such as <code>2014-07</code> being July of 2014.</p> <hr> <h1>Joda-Time</h1> <p>The <a href="http://www.joda.org/joda-time/" rel="nofollow">Joda-Time</a> 2.5 library offers the <a href="http://www.joda.org/joda-time/apidocs/org/joda/time/Interval.html" rel="nofollow"><code>Interval</code></a> class to represent a span of time as a pair of specific moments in time along the timeline of the Universe. Each moment is represented by the <a href="http://www.joda.org/joda-time/apidocs/org/joda/time/DateTime.html" rel="nofollow"><code>DateTime</code></a> class.</p> <h2>Half-Open</h2> <p>Joda-Time uses the Half-Open <code>[)</code> approach to defining spans of time. The beginning is inclusive while the ending is exclusive. This is generally the best way to work with such spans of time. Search StackOverflow for many examples and discussions.</p> <h2>ISO 8601 in Joda-Time</h2> <p>Joda-Time uses the ISO 8601 definition of weeks. Also, Joda-Time uses ISO 8601 as its defaults for parsing and generating string representations of date-time values.</p> <pre><code>DateTimeZone zone = DateTimeZone( "America/Montreal" ); // Get first moment of a Monday. Inclusive. DateTime start = new DateTime( 2014, 11, 24, 0, 0, 0, zone ); // Handle exception thrown if occurring during a Daylight Saving Time gap. DateTime stop = start.plusWeeks( 1 ); // First moment of following Monday. Exclusive. Interval week = new Interval ( start, stop ); </code></pre> <h2>First Monday</h2> <p>Search StackOverflow for many questions and answers on finding the first Monday of a week.</p> <h2><code>LocalDate</code> (date-only)</h2> <p>While you might well be tempted to use <code>LocalDate</code> objects (date only, no time-of-day) to build an <code>Interval</code>. That would be sensible and useful. Unfortunately, the implementation of <code>Interval</code> supports only <code>DateTime</code> objects, not <code>LocalDate</code>.</p> <hr> <h1>java.time</h1> <p>The <a href="http://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html" rel="nofollow">java.time</a> package built into Java 8 and later is inspired by Joda-Time but entirely re-architected. See <a href="https://docs.oracle.com/javase/tutorial/datetime/TOC.html" rel="nofollow">Tutorial</a>.</p> <p>In java.time, an <code>Instant</code> is a moment on the timeline in UTC. Apply a time zone (<code>ZoneId</code>) to get a <code>ZonedDateTime</code>. Use <code>LocalDate</code> to get a date-only value with no time-of-day and no time zone.</p> <p>Note that determining the first moment of a day in java.time requires an extra step when compared to Joda-Time: We must go through the <code>LocalDate</code> class to call its <code>atStartOfDay</code> method.</p> <pre><code>ZoneId zoneId = ZoneId.of ( "America/Montreal" ); ZonedDateTime now = ZonedDateTime.now ( zoneId ); LocalDate firstDayOfThisWeek = now.toLocalDate ().with ( DayOfWeek.MONDAY ); LocalDate firstDayOfNextWeek = firstDayOfThisWeek.plusWeeks ( 1 ); ZonedDateTime thisWeekStart = firstDayOfThisWeek.atStartOfDay ( zoneId ); ZonedDateTime nextWeekStart = firstDayOfNextWeek.atStartOfDay ( zoneId ); </code></pre> <p>Unfortunately, java.time lacks the equivalent of Joda-Time's <code>Interval</code>. </p> <p>Fortunately we have <a href="http://www.threeten.org/threeten-extra/" rel="nofollow">ThreeTen Extra</a>, the project that extends java.time (310 being the number of <a href="https://jcp.org/en/jsr/detail?id=310" rel="nofollow">the JSR defining java.time</a>). This library includes an <a href="http://www.threeten.org/threeten-extra/apidocs/org/threeten/extra/Interval.html" rel="nofollow"><code>Interval</code></a> class that integrates with java.time. This <code>Interval</code> class is more limited than that of Joda-Time as it supports only <code>Instant</code> objects without time zones (always in UTC).</p> <p>Caution: The ThreeTen-Extra project reserves the right to change its interfaces and/or implementations. While intended to be useful as-is, it also serves as an experimental proving ground for classes that may be eventually incorporated into java.time. I gladly make use of ThreeTen-Extra, but you must make your own risk-benefit decision.</p> <pre><code>// This next line requires adding the `ThreeTen Extra` library to your project. Interval interval = Interval.of ( thisWeekStart.toInstant () , nextWeekStart.toInstant () ); // "Interval" is part of ThreeTen-Extra project, not built into Java 8. </code></pre> <p>Dump to console.</p> <pre><code>System.out.println ( "now: " + now + " thisWeekStart: " + thisWeekStart + " nextWeekStart: " + nextWeekStart + " interval: " + interval ); </code></pre> <blockquote> <p>now: 2016-01-15T18:10:48.143-05:00[America/Montreal] thisWeekStart: 2016-01-11T00:00-05:00[America/Montreal] nextWeekStart: 2016-01-18T00:00-05:00[America/Montreal] interval: 2016-01-11T05:00:00Z/2016-01-18T05:00:00Z</p> </blockquote> <p>You can determine the week-of-year as defined by the ISO 8601 standard. Note the "week based" terms. Near the beginning or ending of the year, a date will be in one calendar year while its ISO 8601 week’s year may be ±1.</p> <pre><code>ZoneId zoneId = ZoneId.of ( "America/Montreal" ); ZonedDateTime now = ZonedDateTime.now ( zoneId ); int weekOfYear = now.get ( IsoFields.WEEK_OF_WEEK_BASED_YEAR ); int weekBasedYear = now.get ( IsoFields.WEEK_BASED_YEAR ); System.out.println ( "weekOfYear: " + weekOfYear + " of weekBasedYear: " + weekBasedYear ); </code></pre> <blockquote> <p>weekOfYear: 2 of weekBasedYear: 2016</p> </blockquote>