[Nottingham] HOT Dating one-liner contest

Michael Erskine msemtd at yahoo.co.uk
Mon Jan 14 16:53:48 GMT 2008


On Monday 14 January 2008 16:25:09 Michael Erskine wrote:
> Just use Perl! Or more specifically...
> use Date::Manip;

OK, done it!

use Date::Manip;
foreach(qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)){
    my $query = "1st Wednesday in $_ 2008";
    my $wed = ParseDate($query);
    my $err;
    my $thu = DateCalc($wed,"+ 15 days",\$err);
    print "The $query is ".UnixDate($wed,"%E %b")."\n";
    print "and the following third Thursday is ".UnixDate($thu,"%E %b")."\n";
}

...this gives...

The 1st Wednesday in Jan 2008 is 2nd Jan
and the following third Thursday is 17th Jan
The 1st Wednesday in Feb 2008 is 6th Feb
and the following third Thursday is 21st Feb
The 1st Wednesday in Mar 2008 is 5th Mar
and the following third Thursday is 20th Mar
The 1st Wednesday in Apr 2008 is 2nd Apr
and the following third Thursday is 17th Apr
The 1st Wednesday in May 2008 is 7th May
and the following third Thursday is 22nd May
The 1st Wednesday in Jun 2008 is 4th Jun
and the following third Thursday is 19th Jun
The 1st Wednesday in Jul 2008 is 2nd Jul
and the following third Thursday is 17th Jul
The 1st Wednesday in Aug 2008 is 6th Aug
and the following third Thursday is 21st Aug
The 1st Wednesday in Sep 2008 is 3rd Sep
and the following third Thursday is 18th Sep
The 1st Wednesday in Oct 2008 is 1st Oct
and the following third Thursday is 16th Oct
The 1st Wednesday in Nov 2008 is 5th Nov
and the following third Thursday is 20th Nov
The 1st Wednesday in Dec 2008 is 3rd Dec
and the following third Thursday is 18th Dec

...someone please check for accuracy - I have work to do you know! :)

Regards,
Michael Erskine.

-- 
Timing must be perfect now.  Two-timing must be better than perfect.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mailman.lug.org.uk/pipermail/nottingham/attachments/20080114/6e3544f4/attachment.bin


More information about the Nottingham mailing list