[erlang-patches] week number support

Håkan Mattsson hm@REDACTED
Wed Dec 1 10:43:13 CET 2010


On Tue, Nov 30, 2010 at 9:19 PM, Imre Horvath <imi.horvath@REDACTED> wrote:
> Dear Erlang/OTP Team!
>
> I have started a project on GitHub because I needed the ISO Week Number for a given date
> and I wanted it in Erlang. Since the calendar module in the stdlib-1.17.1 application of
> Erlang/OTP R14B did not provide this functionality, I decided to write it myself. It's based
> on the calendar module and was tested successfully with eunit.
>
> Though currently it's not in a fork of erlang/otp but in a separate repository
> https://github.com/imrehorvath/iso_8601_erl you might want to consider including it into OTP
> if you think it would be useful!

The Eflex application does also implement the algorithm in ISO8601 to
calculate week numbers.
Given a date it returns the week number (and the actual year that the
week belongs to).
See eflex_lib:week_of_the_year/1 in
https://github.com/hawk/eflex/blob/master/src/eflex_lib.erl

When I initially wrote Eflex my intention was to include THE week
calculation algorithm in the
calandar module, but when I detected that ISO8601 just was one of many
algorithms I
dropped that idea. Different parts of the world uses different week
numbering algorithms.
There are several different just in Europe.

/Håkan


More information about the erlang-patches mailing list