#!/usr/bin/perl -w
use strict;
use Date::Tie;
use POSIX qw(strftime);
tie my %base, "Date::Tie";
my $loops;
{
tie my %meet, "Date::Tie",
year => $base{year}, month => $base{month}, day => 1;
# Set the week to the week that has the third tuesday
$meet{week} += $meet{weekday} <= 2 ? 2 : 3;
# Set the day to tuesday
$meet{weekday} = 2;
# Use the next month if we already met (or met/meet today)
$base{month}++, redo
if $meet{yearday} <= $base{yearday} and not $loops++;
print strftime "%d %B %Y\n", 0, 0, 0,
$meet{day}, $meet{month}-1, $meet{year}-1900;
}
(...Rotterdam PM meetings...)
Update - Useful month shifting now (previous went from 19 Nov to 19 Dec, which is not even a tuesday)
- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.