Skip to content

Instantly share code, notes, and snippets.

@xtetsuji
Created October 22, 2012 07:02
Show Gist options
  • Select an option

  • Save xtetsuji/3930052 to your computer and use it in GitHub Desktop.

Select an option

Save xtetsuji/3930052 to your computer and use it in GitHub Desktop.
Dump timetable of September 2012 by UTF-8 Japanese format.
#!/usr/bin/perl
# Dump timetable of September 2012 by UTF-8 Japanese format.
use strict;
use warnings;
use utf8;
use Time::Piece;
use Time::Seconds;
binmode STDOUT, ':utf8';
my @week_ja = qw(日 月 火 水 木 金 土);
my %is_holiday_of = map { $_ => 1 } qw(3 23);
my $day = Time::Piece->strptime("2012/11/01", '%Y/%m/%d');
for( ; $day->mon == 11 ; $day += ONE_DAY ) {
printf "%s(%s)\n", $day->ymd("/"), @week_ja[$day->day_of_week] . ($is_holiday_of{$day->mday} ? ',祝' : '');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment