james28909 has asked for the wisdom of the Perl Monks concerning the following question:
Hello again wise monks :)
I have a list of weekdays:
my @weekdays = qw( Today Yesterday Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday );
I need to format these weekdays into an absolute numerical date based off of scalar localtime. eg:
my ($local_weekday, $local_month, $local_numerical_date) = split (/\s+ +/, scalar localtime), 3; __END__ Fri Apr 28 'Yesterday' would be '27'
I need to use $local_weekday and $local_numerical_date (eg. 'fri 28') to format @weekdays from the list. eg. 'wednesday' to eg. '26'.
Also, i never need to check what the numerical date in the future is, it is always current date or earlier. I am pretty sure there is a way to loop while subtracting but I cant figure it out lol.
If I can be any more clear on anything please let me know. I have tried to explain it the best i can :)
EDIT: changed 'wednesday 27' to just '27' and added 'Yesterday' would be '27' to __END__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Convert weekday to numerical date
by huck (Prior) on Apr 29, 2017 at 03:55 UTC | |
|
Re: Convert weekday to numerical date
by choroba (Cardinal) on Apr 29, 2017 at 05:54 UTC | |
|
Re: Convert weekday to numerical date
by kcott (Archbishop) on Apr 29, 2017 at 06:34 UTC | |
|
Re: Convert weekday to numerical date
by james28909 (Deacon) on May 02, 2017 at 01:36 UTC |