in reply to Localized weekday names

Hello Sec,

By "the list of weekdays in a particular local" you mean working days? If so there is a similar question How to find business days?. If not can you tell us a bit more regarding the days that you are trying to retrieve?

Update: If you simply you want to calculate the days from today to another day you can do it with Date::Manip, sample of code below:

#!/usr/bin/perl use strict; use warnings; use Date::Manip; use feature 'say'; my $tz = new Date::Manip::TZ; my $dateLocal = ParseDate('now'); my $unixLocal = UnixDate($dateLocal,'%A'); say $unixLocal; my $delta = ParseDateDelta("4 days later"); my $date = DateCalc($dateLocal, $delta); my $newDate = UnixDate($date,'%A'); say $newDate; __END__ $ perl test.pl Thursday Monday

Update2: If you want to calculate the working days you can do it like this:

#!/usr/bin/perl use strict; use warnings; use Date::Manip; use feature 'say'; my $tz = new Date::Manip::TZ; my $dateLocal = ParseDate('now'); my $unixLocal = UnixDate($dateLocal,'%A'); say $unixLocal; my $date = DateCalc($dateLocal, "4 days earlier"); my $newDate = UnixDate($date,'%A'); say $newDate; my $businessDeltaMinus = DateCalc($dateLocal,"-4 business days"); my $workingDateMinus = UnixDate($businessDeltaMinus,'%A'); say $workingDateMinus; my $businessDeltaPlus = DateCalc($dateLocal,"+4 business days"); my $workingDatePlus = UnixDate($businessDeltaPlus,'%A'); say $workingDatePlus; __END__ $ perl test.pl Thursday Sunday Friday Wednesday

Update3: If you want one liner solution, sample below:

#!/usr/bin/perl use strict; use warnings; use Date::Manip; use feature 'say'; my $tz = new Date::Manip::TZ; say UnixDate(DateCalc( ParseDate('today'), $_ . " days later") , '%A') for (1..7); __END__ $ perl test.pl Friday Saturday Sunday Monday Tuesday Wednesday Thursday

Update4: In case you want business days, sample below:

#!/usr/bin/perl use strict; use warnings; use Date::Manip; use feature 'say'; my $tz = new Date::Manip::TZ; say UnixDate(DateCalc( ParseDate('today'), $_ . " business days") , '%A') for (1..7); __END__ $ perl test.pl Friday Monday Tuesday Wednesday Thursday Friday Monday

Hope this helps, BR.

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

Replies are listed 'Best First'.
Re^2: Localized weekday names
by Sec (Monk) on Nov 03, 2017 at 15:34 UTC
    It seems that you spent a lot of time on your answer, but unfortunately it seems you misunderstood my question.

    I simply want a list of the localized names of weekdays.

    Look at the other answers if it is still unclear.

    Thanks for your attempt, though.

      Hello Sec,

      Sorry for the late reply, but I just noticed your reply.

      Here is a sample of the same process and module by using French as everyone is providing you:?

      #!/usr/bin/perl use strict; use warnings; use Date::Manip; use feature 'say'; Date_Init("Language=French"); say UnixDate(DateCalc( ParseDate("aujourd'hui"), $_ . " jours plus tard") , '%A') for (1..7); __END__ $ perl test.pl mardi mercredi jeudi vendredi samedi dimanche lundi

      More information regarding the languages that the module can support Date::Manip::Lang.

      Hope this helps, BR.

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