Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/perl/bin/perl use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use Date::Calc qw(Add_Delta_Days Day_of_Week); use strict; # DATE DROPDOWN (last 30 business days) common wherever found my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); $mon++; $year += 1900; my (@date_dd_from,@date_dd_to); #Sample dates my $selected_date_from = "1/21/2008"; my $selected_date_to = "1/21/2008"; for (my $x = 1; $x < 45; $x++) # 45 days later { ($year,$mon,$mday) = Add_Delta_Days($year,$mon,$mday,1); my $dow = Day_of_Week($year,$mon,$mday); if (($dow != 6) && ($dow != 7)){ if ("$mon/$mday/$year" eq "$selected_date_from"){ push(@date_dd_from,"<option selected value=\"$mon/$mday/$yea +r\">$mon/$mday/$year</option>\n"); }else{ push(@date_dd_from,"<option value=\"$mon/$mday/$year\">$ +mon/$mday/$year</option>\n"); } if ("$mon/$mday/$year" eq $selected_date_to){ push(@date_dd_to,"<option selected value=\"$mon/$mday/$year\ +">$mon/$mday/$year</option>\n"); }else{ push(@date_dd_to,"<option value=\"$mon/$mday/$year\">$mo +n/$mday/$year</option>\n"); } } } print "\n@date_dd_to\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting the Latest Date Issue
by locked_user sundialsvc4 (Abbot) on Jan 22, 2008 at 22:17 UTC | |
|
Re: Getting the Latest Date Issue
by Herkum (Parson) on Jan 22, 2008 at 20:51 UTC | |
|
Re: Getting the Latest Date Issue
by olus (Curate) on Jan 22, 2008 at 18:46 UTC | |
by Anonymous Monk on Jan 22, 2008 at 19:20 UTC | |
by olus (Curate) on Jan 22, 2008 at 19:32 UTC | |
by Anonymous Monk on Jan 22, 2008 at 19:49 UTC | |
by olus (Curate) on Jan 22, 2008 at 20:34 UTC | |
| |
|
Re: Getting the Latest Date Issue
by apl (Monsignor) on Jan 22, 2008 at 19:19 UTC | |
by Anonymous Monk on Jan 22, 2008 at 19:24 UTC | |
by apl (Monsignor) on Jan 22, 2008 at 19:48 UTC | |
by Anonymous Monk on Jan 22, 2008 at 19:51 UTC | |
by Anonymous Monk on Jan 22, 2008 at 19:27 UTC | |
|
Re: Getting the Latest Date Issue
by eric256 (Parson) on Jan 22, 2008 at 20:58 UTC | |
by eric256 (Parson) on Jan 22, 2008 at 22:37 UTC |