[plug] Command to find out a particular date occurence

Jeremy Malcolm Jeremy at Malcolm.id.au
Tue Jan 14 20:58:38 WST 2003


On Tue, 14 Jan 2003 08:50:07 +0000 (UTC)
brad at mapsolutions.com.au (Brad Browne) wrote:

> In this spirit of the units utility, is there a calendar utility that
> will allow me to type the date, like Jan 21 Fri or similar, and it
> will tell me what year it will fall in ?  BTW, after Leon hit the list
> with a description of units I have been using it ever since, so kudos
> to you Leon !!

#!/usr/bin/perl
use Date::Manip;
@dates1 = &ParseRecur("*1900-2000:1:0:21:0:0:0");
foreach $date1( @dates1 ) {
  $year = substr $date1,0,4;
  @dates2 = &ParseRecur("every 1st friday in $year");
  foreach $date2 ( @dates2 ) {
    if ( $date1 eq $date2 ) {
      print "$date2\n"
    }
  }
}

-- 
JEREMY MALCOLM <Jeremy at Malcolm.id.au> Personal: http://www.malcolm.id.au
Providing online networks of Australian lawyers (http://www.ilaw.com.au)
and Linux experts (http://www.linuxconsultants.com.au) for instant help!
Disclaimer: http://www.terminus.net.au/disclaimer.html. GPG key: finger.



More information about the plug mailing list