- Timestamp:
- 1999-08-24T09:21:38+12:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/sorttools.pm
r392 r467 36 36 37 37 # takes arguments of day, month, year and converts to 38 # date of form yyyymmdd. month may be full (e.g. "January") 39 # or abbreviated (e.g. "Jan"). Years like "86" will be40 # assumed to be "1986".38 # date of form yyyymmdd. month may be full (e.g. "January"), 39 # abbreviated (e.g. "Jan"), or a number (1-12). Years like "86" 40 # will be assumed to be "1986". 41 41 sub format_date { 42 42 my ($day, $month, $year) = @_; … … 61 61 $day = "0$day" if (length($day) == 1); 62 62 63 if (!defined $months{$month}) { 63 if ($month =~ /^\d\d?$/) { 64 if ($month < 1) { 65 print STDERR "sorttools::format_date WARNING month $month out of range\n"; 66 $month = "01"; 67 } elsif ($month > 12) { 68 print STDERR "sorttools::format_date WARNING month $month out of range\n"; 69 $month = "12"; 70 } 71 if ($month =~ /^\d$/) { 72 $month = "0" . $month; 73 } 74 } elsif (!defined $months{$month}) { 64 75 print STDERR "sorttools::format_date WARNING month $month out of range\n"; 65 76 $month = "01";
Note:
See TracChangeset
for help on using the changeset viewer.