Module: JapaneseCalendar::Weekday

Includes:
Deprecation::WeekdayWrapper, Calculations
Included in:
Date, DateTime, Time
Defined in:
lib/japanese_calendar/weekday.rb,
lib/japanese_calendar/weekday/calculations.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Calculations

Instance Method Summary collapse

Instance Method Details

#strftime(format) ⇒ Object

Formats the day of the week according to the directives in the given format string.

Format directives:

%JA - The full weekday name in Japanese ("日曜日")
%Ja - The abbreviated weekday name in Japanese ("日")

Examples:

date_of_birth = Time.new(1978, 7, 19)

date_of_birth.strftime("%JA")  # => "水曜日"
date_of_birth.strftime("%Ja")  # => "水"

date_of_birth.strftime("%-Y年%-m月%-d日(%Ja)") # => "1978年7月19日(水)"


26
27
28
29
# File 'lib/japanese_calendar/weekday.rb', line 26

def strftime(format)
  string = super(format)
  string.gsub(weekday_pattern, weekday_conversion)
end