class TZInfo::Timezone

def local_timestamp(year, month = 1, day = 1, hour = 0, minute = 0, second = 0, sub_second = 0, dst = Timezone.default_dst, &block)

Raises:
  • (AmbiguousTime) - if the date and time parameters are ambiguous for
  • (PeriodNotFound) - if the date and time parameters do not specify a
  • (RangeError) - if `sub_second` is a `Rational` but that is less
  • (RangeError) - if `second` is not between 0 and 59.
  • (RangeError) - if `minute` is not between 0 and 59.
  • (RangeError) - if `hour` is not between 0 and 23.
  • (RangeError) - if `day` is not between 1 and 31.
  • (RangeError) - if `month` is not between 1 and 12.
  • (ArgumentError) - if `utc_offset` is not `nil`, not an `Integer`
  • (ArgumentError) - if `sub_second` is not a `Rational`, or the
  • (ArgumentError) - if either of `year`, `month`, `day`, `hour`,

Returns:
  • (TimestampWithOffset) - a new {Timestamp} object based on the given

Other tags:
    Yieldreturn: - to resolve the ambiguity: a chosen {TimezonePeriod}

Other tags:
    Yieldparam: periods - an `Array` containing all

Other tags:
    Yield: - if the `dst` parameter did not resolve an ambiguity, an

Parameters:
  • dst (Boolean) -- whether to resolve ambiguous local times by always
  • sub_second (Numeric) -- the fractional part of the second as either
  • second (Integer) -- the second (0-59).
  • minute (Integer) -- the minute (0-59).
  • hour (Integer) -- the hour (0-23).
  • day (Integer) -- the day of the month (1-31).
  • month (Integer) -- the month (1-12).
  • year (Integer) -- the year.
def local_timestamp(year, month = 1, day = 1, hour = 0, minute = 0, second = 0, sub_second = 0, dst = Timezone.default_dst, &block)
  ts = Timestamp.create(year, month, day, hour, minute, second, sub_second)
  timezone_offset = period_for_local(ts, dst, &block).offset
  utc_offset = timezone_offset.observed_utc_offset
  TimestampWithOffset.new(ts.value - utc_offset, sub_second, utc_offset).set_timezone_offset(timezone_offset)
end