Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #35589

Re: Parsing calendar weeks to LocalDates with DateTimeFormatter

From Tassilo Horn <tsdh@gnu.org>
Newsgroups comp.lang.java.programmer
Subject Re: Parsing calendar weeks to LocalDates with DateTimeFormatter
Date 2016-09-12 09:18 +0200
Organization University Koblenz-Landau Campus Koblenz
Message-ID <8760q1fuw4.fsf@gnu.org> (permalink)
References <87inu8gpqv.fsf@gnu.org> <XSD8BfGz2y0XFwl7@invalid.uk.co.demon.merlyn.invalid>

Show all headers | View raw


Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> writes:

Hi,

>>I have a
>>
>>  DateTimeFormatter FORMATTER_KW = DateTimeFormatter.ofPattern("ww.YYYY");
>>
>>for formatting LocalDates as calendar weeks.
>
>
> Firstly, you need to say, clearly, what your definition of Week
> Numbering is.
>
> You seem to be at U.Koblenz,

Not anymore but...

> so you should be using ISO 8601 weeks, in which all weeks are Mon=1 to
> Sun=7 and Week 01 contains January 4th (i.e. is the first week which
> is all or mostly in the Gregorian Year), so the last week of the year
> is numbered 52 or 53; there is never a Week 00 or a Week 54.

...that's the week numbering definition we are using, yes.

> ISO Week Numbering is used throughout the sensible part of the
> Gregorian world, but not much along the Mexico-Canada borderland.

As far as I can tell, we don't have a customer in the Mexico-Canada
borderland yet.

> <http://web.archive.org/web/20150723023855/http://www.merlyn.demon.co.uk
> /weekinfo.htm> or later, <http://web.archive.org/web/20150711063435/http
> ://www.merlyn.demon.co.uk/weekcalc.htm> or later, and <http://web.archiv
> e.org/web/20150703002408/http://www.merlyn.demon.co.uk/js-date7.htm> or
> later, might help readers; but their code is not Java.

No problem in not being Java, and it's definitely nice how to do these
calculations "by hand".  Yet my question was if there was some standard
way to come from a calendar week (ISO 8601) to a LocalDate other than
the snippet I've posted.

Bye,
Tassilo

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Parsing calendar weeks to LocalDates with DateTimeFormatter Tassilo Horn <tsdh@gnu.org> - 2016-09-07 08:58 +0200
  Re: Parsing calendar weeks to LocalDates with DateTimeFormatter Tassilo Horn <tsdh@gnu.org> - 2016-09-07 10:11 +0200
  Re: Parsing calendar weeks to LocalDates with DateTimeFormatter Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-09-09 22:46 +0100
    Re: Parsing calendar weeks to LocalDates with DateTimeFormatter Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-09-11 16:43 +0100
      Re: Parsing calendar weeks to LocalDates with DateTimeFormatter Lew <lewbloch@gmail.com> - 2016-09-13 17:50 -0700
        Re: Parsing calendar weeks to LocalDates with DateTimeFormatter Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-09-17 19:34 +0100
    Re: Parsing calendar weeks to LocalDates with DateTimeFormatter Tassilo Horn <tsdh@gnu.org> - 2016-09-12 09:18 +0200
      Re: Parsing calendar weeks to LocalDates with DateTimeFormatter Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-09-13 23:39 +0100

csiph-web