root/platform/tdiary/plugin/jdate.rb

Revision 5057, 0.6 kB (checked in by hsbt, 11 months ago)

platform/tdiary/plugin: changed file encoding to UTF-8

Line 
1# jdate.rb $Revision: 1.1 $
2#
3#「%J」で日本語の曜日名を出す
4#    pluginに入れるだけで動作する。
5#    日付フォーマットなどで「%J」を指定するとそこが日本語の曜日になる
6#
7# Copyright (c) 2003 TADA Tadashi <sho@spc.gr.jp>
8# You can distribute this file under the GPL.
9#
10unless Time::new.respond_to?( :strftime_jdate_backup ) then
11        eval( <<-MODIFY_CLASS, TOPLEVEL_BINDING )
12                class Time
13                   alias strftime_jdate_backup strftime
14                   JWDAY = %w(日 月 火 水 木 金 土)
15                   def strftime( format )
16                      strftime_jdate_backup( format.gsub( /%J/, JWDAY[self.wday] ) )
17                   end
18                end
19        MODIFY_CLASS
20end
Note: See TracBrowser for help on using the browser.