Hello sshingor,

Welcome to the Monastery. I will agree with the fellow Monks that have already replied to your question. Just to add something minor here on how the week numbers are calculated.

Read the documentation from ISO_8601/Week_dates:

The week number can be described by counting the Thursdays: week 12 co +ntains the 12th Thursday of the year. The ISO week-numbering year starts at the first day (Monday) of week 0 +1 and ends at the Sunday before the new ISO year (hence without overl +ap or gap). It consists of 52 or 53 full weeks. The first ISO week of + a year may have up to three days that are actually in the Gregorian +calendar year that is ending; if three, they are Monday, Tuesday and +Wednesday. Similarly, the last ISO week of a year may have up to thre +e days that are actually in the Gregorian calendar year that is start +ing; if three, they are Friday, Saturday, and Sunday. The Thursday of + each ISO week is always in the Gregorian calendar year denoted by th +e ISO week-numbering year. Examples: Monday 29 December 2008 is written "2009-W01-1" Sunday 3 January 2010 is written "2009-W53-7"

Minor sample of code with Date::Manip:

#!/usr/bin/perl use strict; use warnings; use Date::Manip; use feature 'say'; my $datestr = ParseDate("01/01/2016"); my $secs = UnixDate($datestr,'%s'); say ParseDateString("epoch $secs"); say UnixDate($datestr,"%J"); __END__ $ perl test.pl 2016010100:00:00 2015-W53-5

Hope this helps, BR.

Seeking for Perl wisdom...on the process of learning...not there...yet!

In reply to Re: Another date question by thanos1983
in thread Another date question by sshingor

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.