Module | CustomFormatTranslator
In: | lib/custom_format_translator.rb

日付フォーマット部品の実装。

### Methods

format_date

### Constants

STRFTIME_TABLE | = | { "yyyy" => "%Y", "yy" => "%y", "yyyy/mm" => "%Y/%m", "yyyy-mm" => "%Y-%m", "yyyymm" => "%Y%m", "yy/mm" => "%y/%m", "yy-mm" => "%y-%m", "yymm" => "%y%m", "yyyy/mm/dd" => "%Y/%m/%d", "yyyy-mm-dd" => "%Y-%m-%d", "yyyymmdd" => "%Y%m%d", "yy/mm/dd" => "%y/%m/%d", "yy-mm-dd" => "%y-%m-%d", "yymmdd" => "%y%m%d", }

### Public Class methods

format_date(date, format)

date を format に従って書式化し文字列として返す。

[Source]

        # File lib/custom_format_translator.rb, line 22
    22:   def self.format_date(date, format)
    23:     raise ArgumentError, "invalid format: #{format}" unless STRFTIME_TABLE.has_key?(format)
    24:     return date.strftime(STRFTIME_TABLE[format])
    25:   end

[Validate]