Struct Offset
Implements
Inherited Members
Namespace: NodaTime
Assembly: NodaTime.dll
Syntax
[Serializable]
public struct Offset : IEquatable<Offset>, IComparable<Offset>, IFormattable, IComparable, IXmlSerializable, ISerializable
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Fields
MaxValue
Declaration
public static readonly Offset MaxValue
Field Value
Type | Description |
---|---|
Offset |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
MinValue
Declaration
public static readonly Offset MinValue
Field Value
Type | Description |
---|---|
Offset |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Zero
Declaration
public static readonly Offset Zero
Field Value
Type | Description |
---|---|
Offset |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Properties
Milliseconds
Declaration
public int Milliseconds { get; }
Property Value
Type | Description |
---|---|
Int32 | The number of milliseconds represented by this offset, which may be negative. |
Remarks
Nanoseconds
Declaration
public long Nanoseconds { get; }
Property Value
Type | Description |
---|---|
Int64 | The number of nanoseconds. |
Remarks
Seconds
Declaration
public int Seconds { get; }
Property Value
Type | Description |
---|---|
Int32 | The number of seconds represented by this offset, which may be negative. |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Ticks
Declaration
public long Ticks { get; }
Property Value
Type | Description |
---|---|
Int64 | The number of ticks. |
Remarks
Methods
Add(Offset, Offset)
operator+()
.
Declaration
public static Offset Add(Offset left, Offset right)
Parameters
Type | Name | Description |
---|---|---|
Offset | left | The left hand side of the operator. |
Offset | right | The right hand side of the operator. |
Returns
Type | Description |
---|---|
Offset | A new Offset representing the sum of the given values. |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The result of the operation is outside the range of Offset. |
ArgumentOutOfRangeException | The result of the operation is outside the range of Offset. |
CompareTo(Offset)
Declaration
public int CompareTo(Offset other)
Parameters
Type | Name | Description |
---|---|---|
Offset | other | An object to compare with this object. |
Returns
Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
Int32 |
A 32-bit signed integer that indicates the relative order of the objects being compared.
The return value has the following meanings:
|
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Equals(Offset)
Declaration
public bool Equals(Offset other)
Parameters
Type | Name | Description |
---|---|---|
Offset | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
Boolean |
true if the current object is equal to the other parameter;
otherwise, false.
|
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The Object to compare with this instance. |
Returns
Type | Description |
---|---|
Boolean |
true if the specified Object is equal to this instance;
otherwise, false .
|
Overrides
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
FromHours(Int32)
Declaration
public static Offset FromHours(int hours)
Parameters
Type | Name | Description |
---|---|---|
Int32 | hours | The number of hours to represent in the new offset. |
Returns
Type | Description |
---|---|
Offset | An offset representing the given value. |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Sample snippet
using NodaTime;
using System;
Offset offset = Offset.FromHours(1);
Console.WriteLine(offset.Seconds);
Output:
3600
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The specified number of hours is outside the range of [-18, +18]. |
FromHoursAndMinutes(Int32, Int32)
Declaration
public static Offset FromHoursAndMinutes(int hours, int minutes)
Parameters
Type | Name | Description |
---|---|---|
Int32 | hours | The number of hours to represent in the new offset. |
Int32 | minutes | The number of minutes to represent in the new offset. |
Returns
Type | Description |
---|---|
Offset | An offset representing the given value. |
Remarks
Offset.FromHoursAndMinutes(-3, -10)
.
Sample snippet
using NodaTime;
using System;
Offset offset = Offset.FromHoursAndMinutes(1, 1);
Console.WriteLine(offset.Seconds);
Output:
3660
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The result of the operation is outside the range of Offset. |
FromMilliseconds(Int32)
Declaration
public static Offset FromMilliseconds(int milliseconds)
Parameters
Type | Name | Description |
---|---|---|
Int32 | milliseconds | The int milliseconds value. |
Returns
Type | Description |
---|---|
Offset | An offset representing the given number of milliseconds, to the (truncated) second. |
Remarks
Sample snippet
using NodaTime;
using System;
Offset offset = Offset.FromMilliseconds(1200);
Console.WriteLine(offset.Seconds);
Console.WriteLine(offset.Milliseconds);
Output:
1
1000
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The specified number of milliseconds is outside the range of [-18, +18] hours. |
FromNanoseconds(Int64)
Declaration
public static Offset FromNanoseconds(long nanoseconds)
Parameters
Type | Name | Description |
---|---|---|
Int64 | nanoseconds | The number of nanoseconds specifying the length of the new offset. |
Returns
Type | Description |
---|---|
Offset | An offset representing the given number of nanoseconds, to the (truncated) second. |
Remarks
Sample snippet
using NodaTime;
using System;
Offset offset = Offset.FromNanoseconds(1_200_000_000);
Console.WriteLine(offset.Seconds);
Console.WriteLine(offset.Nanoseconds);
Output:
1
1000000000
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The specified number of nanoseconds is outside the range of [-18, +18] hours. |
FromSeconds(Int32)
Declaration
public static Offset FromSeconds(int seconds)
Parameters
Type | Name | Description |
---|---|---|
Int32 | seconds | The int seconds value. |
Returns
Type | Description |
---|---|
Offset | An offset representing the given number of seconds. |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Sample snippet
using NodaTime;
using System;
Offset offset = Offset.FromSeconds(450);
Console.WriteLine(offset.Seconds);
Output:
450
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The specified number of seconds is outside the range of [-18, +18] hours. |
FromTicks(Int64)
Declaration
public static Offset FromTicks(long ticks)
Parameters
Type | Name | Description |
---|---|---|
Int64 | ticks | The number of ticks specifying the length of the new offset. |
Returns
Type | Description |
---|---|
Offset | An offset representing the given number of ticks, to the (truncated) second. |
Remarks
Sample snippet
using NodaTime;
using System;
Offset offset = Offset.FromTicks(15_000_000);
Console.WriteLine(offset.Ticks);
Console.WriteLine(offset.Seconds);
Output:
10000000
1
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The specified number of ticks is outside the range of [-18, +18] hours. |
FromTimeSpan(TimeSpan)
Declaration
public static Offset FromTimeSpan(TimeSpan timeSpan)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeSpan | The timespan to convert |
Returns
Type | Description |
---|---|
Offset | An offset for the same time as the given time span. |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Sample snippet
using NodaTime;
using System;
var timespan = TimeSpan.FromHours(1.5);
Offset offset = Offset.FromTimeSpan(timespan);
Console.WriteLine(offset.Seconds);
Output:
5400
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The given time span falls outside the range of +/- 18 hours. |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Max(Offset, Offset)
Declaration
public static Offset Max(Offset x, Offset y)
Parameters
Type | Name | Description |
---|---|---|
Offset | x | The first offset |
Offset | y | The second offset |
Returns
Type | Description |
---|---|
Offset | The greater offset of x and y . |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Min(Offset, Offset)
Declaration
public static Offset Min(Offset x, Offset y)
Parameters
Type | Name | Description |
---|---|---|
Offset | x | The first offset |
Offset | y | The second offset |
Returns
Type | Description |
---|---|
Offset | The lower offset of x and y . |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Minus(Offset)
operator-()
.
Declaration
public Offset Minus(Offset other)
Parameters
Type | Name | Description |
---|---|---|
Offset | other | The offset to subtract |
Returns
Type | Description |
---|---|
Offset | The result of subtracting the other offset from this one. |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Sample snippet
using NodaTime;
using System;
var offset = Offset.FromSeconds(100);
var offset2 = Offset.FromSeconds(120);
var expected = Offset.FromSeconds(-20);
var actual = offset.Minus(offset2);
Console.WriteLine(actual);
Output:
-00:00:20
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The result of the operation is outside the range of Offset. |
Negate(Offset)
Declaration
public static Offset Negate(Offset offset)
Parameters
Type | Name | Description |
---|---|---|
Offset | offset | The offset to negate. |
Returns
Type | Description |
---|---|
Offset | The negation of the specified offset. |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Plus(Offset)
operator+()
.
Declaration
public Offset Plus(Offset other)
Parameters
Type | Name | Description |
---|---|---|
Offset | other | The offset to add |
Returns
Type | Description |
---|---|
Offset | The result of adding the other offset to this one. |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Sample snippet
using NodaTime;
using System;
var offset = Offset.FromSeconds(100);
var offset2 = Offset.FromSeconds(150);
var expected = Offset.FromSeconds(250);
var actual = offset.Plus(offset2);
Console.WriteLine(actual);
Output:
+00:04:10
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The result of the operation is outside the range of Offset. |
Subtract(Offset, Offset)
operator-()
.
Declaration
public static Offset Subtract(Offset minuend, Offset subtrahend)
Parameters
Type | Name | Description |
---|---|---|
Offset | minuend | The left hand side of the operator. |
Offset | subtrahend | The right hand side of the operator. |
Returns
Type | Description |
---|---|
Offset | A new Offset representing the difference of the given values. |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The result of the operation is outside the range of Offset. |
ArgumentOutOfRangeException | The result of the operation is outside the range of Offset. |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | The value of the current instance in the default format pattern ("g"), using the current thread's culture to obtain a format provider. |
Overrides
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
ToString(String, IFormatProvider)
Declaration
public string ToString(string patternText, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
String | patternText | The String specifying the pattern to use, or null to use the default format pattern ("g"). |
IFormatProvider | formatProvider | The IFormatProvider to use when formatting the value, or null to use the current thread's culture to obtain a format provider. |
Returns
Type | Description |
---|---|
String | A String containing the value of the current instance in the specified format. |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
ToTimeSpan()
Declaration
public TimeSpan ToTimeSpan()
Returns
Type | Description |
---|---|
TimeSpan | An equivalent TimeSpan to this value. |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Sample snippet
using NodaTime;
using System;
var offset = Offset.FromSeconds(120);
var actual = offset.ToTimeSpan();
var expected = TimeSpan.FromSeconds(120);
Console.WriteLine(actual);
Output:
00:02:00
Operators
Addition(Offset, Offset)
Declaration
public static Offset operator +(Offset left, Offset right)
Parameters
Type | Name | Description |
---|---|---|
Offset | left | The left hand side of the operator. |
Offset | right | The right hand side of the operator. |
Returns
Type | Description |
---|---|
Offset | A new Offset representing the sum of the given values. |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The result of the operation is outside the range of Offset. |
ArgumentOutOfRangeException | The result of the operation is outside the range of Offset. |
Equality(Offset, Offset)
Declaration
public static bool operator ==(Offset left, Offset right)
Parameters
Type | Name | Description |
---|---|---|
Offset | left | The left hand side of the operator. |
Offset | right | The right hand side of the operator. |
Returns
Type | Description |
---|---|
Boolean | true if values are equal to each other, otherwise false . |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
GreaterThan(Offset, Offset)
Declaration
public static bool operator>(Offset left, Offset right)
Parameters
Type | Name | Description |
---|---|---|
Offset | left | The left hand side of the operator. |
Offset | right | The right hand side of the operator. |
Returns
Type | Description |
---|---|
Boolean | true if the left value is greater than the right value, otherwise false . |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
GreaterThanOrEqual(Offset, Offset)
Declaration
public static bool operator >=(Offset left, Offset right)
Parameters
Type | Name | Description |
---|---|---|
Offset | left | The left hand side of the operator. |
Offset | right | The right hand side of the operator. |
Returns
Type | Description |
---|---|
Boolean | true if the left value is greater than or equal to the right value, otherwise false . |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Inequality(Offset, Offset)
Declaration
public static bool operator !=(Offset left, Offset right)
Parameters
Type | Name | Description |
---|---|---|
Offset | left | The left hand side of the operator. |
Offset | right | The right hand side of the operator. |
Returns
Type | Description |
---|---|
Boolean | true if values are not equal to each other, otherwise false . |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
LessThan(Offset, Offset)
Declaration
public static bool operator <(Offset left, Offset right)
Parameters
Type | Name | Description |
---|---|---|
Offset | left | The left hand side of the operator. |
Offset | right | The right hand side of the operator. |
Returns
Type | Description |
---|---|
Boolean | true if the left value is less than the right value, otherwise false . |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
LessThanOrEqual(Offset, Offset)
Declaration
public static bool operator <=(Offset left, Offset right)
Parameters
Type | Name | Description |
---|---|---|
Offset | left | The left hand side of the operator. |
Offset | right | The right hand side of the operator. |
Returns
Type | Description |
---|---|
Boolean | true if the left value is less than or equal to the right value, otherwise false . |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Subtraction(Offset, Offset)
Declaration
public static Offset operator -(Offset minuend, Offset subtrahend)
Parameters
Type | Name | Description |
---|---|---|
Offset | minuend | The left hand side of the operator. |
Offset | subtrahend | The right hand side of the operator. |
Returns
Type | Description |
---|---|
Offset | A new Offset representing the difference of the given values. |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The result of the operation is outside the range of Offset. |
ArgumentOutOfRangeException | The result of the operation is outside the range of Offset. |
UnaryNegation(Offset)
Declaration
public static Offset operator -(Offset offset)
Parameters
Type | Name | Description |
---|---|---|
Offset | offset | The offset to negate. |
Returns
Type | Description |
---|---|
Offset | A new Offset instance with a negated value. |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
UnaryPlus(Offset)
Declaration
public static Offset operator +(Offset offset)
Parameters
Type | Name | Description |
---|---|---|
Offset | offset | The operand. |
Returns
Type | Description |
---|---|
Offset | The same Offset instance |
Remarks
Explicit Interface Implementations
IComparable.CompareTo(Object)
Declaration
int IComparable.CompareTo(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object to compare this value with. |
Returns
Type | Description |
---|---|
Int32 | The result of comparing this instant with another one; see CompareTo(Offset) for general details.
If obj is null, this method returns a value greater than 0.
|
Remarks
Exceptions
Type | Condition |
---|---|
ArgumentException | obj is non-null but does not refer to an instance of Offset. |
ISerializable.GetObjectData(SerializationInfo, StreamingContext)
Declaration
[SecurityCritical]
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
SerializationInfo | info | The SerializationInfo to populate with data. |
StreamingContext | context | The destination for this serialization. |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Exceptions
Type | Condition |
---|---|
ArgumentNullException | info is null. |
IXmlSerializable.GetSchema()
Declaration
XmlSchema IXmlSerializable.GetSchema()
Returns
Type | Description |
---|---|
XmlSchema |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
IXmlSerializable.ReadXml(XmlReader)
Declaration
void IXmlSerializable.ReadXml(XmlReader reader)
Parameters
Type | Name | Description |
---|---|---|
XmlReader | reader |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Exceptions
Type | Condition |
---|---|
ArgumentNullException | reader is null. |
IXmlSerializable.WriteXml(XmlWriter)
Declaration
void IXmlSerializable.WriteXml(XmlWriter writer)
Parameters
Type | Name | Description |
---|---|---|
XmlWriter | writer |
Remarks
Offsets are always in the range of [-18, +18] hours. (Note that the ends are inclusive, so an offset of 18 hours can be represented, but an offset of 18 hours and one second cannot.) This allows all offsets within TZDB to be represented. The BCL DateTimeOffset type only allows offsets up to 14 hours, which means some historical data within TZDB could not be represented.
Offsets are represented with a granularity of one second. This allows all offsets within TZDB to be represented. It is possible that it could present issues to some other time zone data sources, but only in very rare historical cases (or fictional ones).
Exceptions
Type | Condition |
---|---|
ArgumentNullException | writer is null. |