HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/gems/default/doc/tzinfo-2.0.4/ri/TZInfo/Timezone/local_to_utc-i.ri
U:RDoc::AnyMethod[iI"local_to_utc:ETI""TZInfo::Timezone#local_to_utc;TF:publico:RDoc::Markup::Document:@parts[(o:RDoc::Markup::Paragraph;	[I"4Converts a local time for the time zone to UTC.;To:RDoc::Markup::BlankLineo;
;	[I"PThe result will either be a `Time`, `DateTime` or {Timestamp} according to ;TI",the type of the `local_time` parameter.;T@o;
;	[I"OThe UTC offset of the `local_time` parameter is ignored (it is treated as ;TI"4a time in the time zone represented by `self`).;T@o;
;	[
I"M_Warning:_ There are local times that have no equivalent UTC times (for ;TI"Kexample, during the transition from standard time to daylight savings ;TI"Ntime). There are also local times that have more than one UTC equivalent ;TI"P(for example, during the transition from daylight savings time to standard ;TI"time).;T@o;
;	[I"NIn the first case (no equivalent UTC time), a {PeriodNotFound} exception ;TI"will be raised.;T@o;
;	[I"PIn the second case (more than one equivalent UTC time), an {AmbiguousTime} ;TI"Kexception will be raised unless the optional `dst` parameter or block ;TI"handles the ambiguity.;T@o;
;	[	I"KIf the ambiguity is due to a transition from daylight savings time to ;TI"Jstandard time, the `dst` parameter can be used to select whether the ;TI"Mdaylight savings time or local time is used. For example, the following ;TI"3code would raise an {AmbiguousTime} exception:;T@o:RDoc::Markup::Verbatim;	[I"3tz = TZInfo::Timezone.get('America/New_York')
;TI"6tz.period_for_local(Time.new(2004,10,31,1,30,0))
;T:@format0o;
;	[I"KSpecifying `dst = true` would select the daylight savings period from ;TI"FApril to October 2004. Specifying `dst = false` would return the ;TI":standard time period from October 2004 to April 2005.;T@o;
;	[I"LThe `dst` parameter will not be able to resolve an ambiguity resulting ;TI"Pfrom the clocks being set back without changing from daylight savings time ;TI"Pto standard time. In this case, if a block is specified, it will be called ;TI"Kto resolve the ambiguity. The block must take a single parameter - an ;TI"J`Array` of {TimezonePeriod}s that need to be resolved. The block can ;TI"Mselect and return a single {TimezonePeriod} or return `nil` or an empty ;TI"@`Array` to cause an {AmbiguousTime} exception to be raised.;T@o;
;	[I"EThe default value of the `dst` parameter can be specified using ;TI"{Timezone.default_dst=}.;T@o;
;	[I"E@param local_time [Object] a `Time`, `DateTime` or {Timestamp}. ;TI"L@param dst [Boolean] whether to resolve ambiguous local times by always;To;;	[I"Kselecting the period observing daylight savings time (`true`), always
;TI"Lselecting the period observing standard time (`false`), or leaving the
;TI"#ambiguity unresolved (`nil`).
;T;
0o;
;	[I"M@yield [periods] if the `dst` parameter did not resolve an ambiguity, an;To;;	[I"#optional block is yielded to.
;T;
0o;
;	[I"J@yieldparam periods [Array<TimezonePeriod>] an `Array` containing all;To;;	[I"Lthe {TimezonePeriod}s that still match `local_time` after applying the
;TI"`dst` parameter.
;T;
0o;
;	[I"N@yieldreturn [Object] to resolve the ambiguity: a chosen {TimezonePeriod};To;;	[I"For an `Array` containing a chosen {TimezonePeriod}; to leave the
;TI"Mambiguity unresolved: an empty `Array`, an `Array` containing more than
;TI"%one {TimezonePeriod}, or `nil`.
;T;
0o;
;	[I"E@return [Object] the UTC equivalent of `local_time` as a `Time`,;To;;	[I" `DateTime` or {Timestamp}.
;T;
0o;
;	[I"6@raise [ArgumentError] if `local_time` is `nil`. ;TI"K@raise [PeriodNotFound] if `local_time` is not valid for the time zone;To;;	[I"((there is no equivalent UTC time).
;T;
0o;
;	[I"O@raise [AmbiguousTime] if `local_time` was ambiguous for the time zone and;To;;	[I"@the `dst` parameter or block did not resolve the ambiguity.;T;
0:
@fileI"lib/tzinfo/timezone.rb;T:0@omit_headings_from_table_of_contents_below00I"periods;T[I"-(local_time, dst = Timezone.default_dst);T@tFI"
Timezone;TcRDoc::NormalClass00