Method: TZInfo::Timezone#strftime
- Defined in:
- lib/tzinfo/timezone.rb
#strftime(format, time = Time.now) ⇒ String
Converts a time to local time for the time zone and returns a String
representation of the local time according to the given format.
Timezone#strftime
first expands any occurrences of %Z
in the format
string to the time zone abbreviation for the local time (for example, EST
or EDT). Depending on the type of time
parameter, the result of the
expansion is then passed to either Time#strftime
, DateTime#strftime
or
Timestamp#strftime
to handle any other format directives.
This method is equivalent to the following:
time_zone.to_local(time).strftime(format)
1039 1040 1041 |
# File 'lib/tzinfo/timezone.rb', line 1039 def strftime(format, time = Time.now) to_local(time).strftime(format) end |