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!

In reply to Re: Localized weekday names by thanos1983
in thread Localized weekday names by Sec

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.