http://www.perlmonks.org?node_id=1221189


in reply to Re: Another date question
in thread Another date question

I agree with others that in most cases, you're better off sticking with the ISO 8601 definitions. But, just in case you're interested, Date::Manip defaults to ISO 8601, but you can specify other definitions of week using some of the config variables that are built in. For example:

Most of the time I would discourage using these... but they are there if you need them.

Replies are listed 'Best First'.
Re^3: Another date question [UPDATED]
by thanos1983 (Parson) on Aug 27, 2018 at 13:41 UTC

    Hello SBECK,

    Thanks a lot for this information I had no idea about that. Just to add more information in case that someone is interested those variables can be set at the config file. More information can be found in the official documentation Date::Manip::Config/BASIC CONFIGURATION VARIABLES.

    Update: Just for future reference in case that someone is interested to overwrite the ISO 8601 (not recommended). As fellow Monk SBECK indicated we can use the Jan1Week1=1 a small sample of code:

    #!/usr/bin/perl use strict; use warnings; use Date::Manip; use feature 'say'; my $datestr = ParseDate("01/01/2016"); say UnixDate($datestr,"%J"); Date_Init("Jan1Week1=1"); say UnixDate($datestr,"%J"); __END__ $ perl test.pl 2015-W53-5 2016-W01-5

    In case that someone does not want to define the config file is can load the configurations like this. More information on the official documentation. Sample of config file can be found here Date::Manip::ConfigFile - sample config file.

    BR / Thanos

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