1
# jyear.rb $Revision: 1.1 $
5
# 「%Y」で「2005」のところを、「%K」で「平成17」と表示。
8
# Copyright (c) 2005 sasasin/SuzukiShinnosuke<sasasin@sasasin.sytes.net>
9
# You can distribute this file under the GPL.
12
unless Time::new.respond_to?( :strftime_jyear_backup ) then
13
eval( <<-MODIFY_CLASS, TOPLEVEL_BINDING )
15
alias strftime_jyear_backup strftime
16
def strftime( format )
20
if self.year == 1926 && self.month == 12 && self.day >=25 then
24
jyear = self.year - 1925
25
gengo = "昭和" + jyear.to_s
26
if self.year == 1989 && self.month == 1 && self.day >= 8 then
30
jyear = self.year - 1988
31
gengo = "平成" + jyear.to_s
33
strftime_jyear_backup( format.gsub( /%K/, gengo ) )