Class DateTimeOffsetExtensions
Extension methods for System.DateTimeOffset.
Since 2.0.x
Availability net45, netstandard1.3
Inheritance
Object
DateTimeOffsetExtensions
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: NodaTime.Extensions
Assembly: NodaTime.dll
Syntax
public static class DateTimeOffsetExtensions
Methods
ToInstant(DateTimeOffset)
Converts a System.DateTimeOffset into an Instant.
Since 2.0.x
Availability net45, netstandard1.3
Declaration
public static Instant ToInstant(this DateTimeOffset dateTimeOffset)
Parameters
Type | Name | Description |
---|---|---|
DateTimeOffset | dateTimeOffset | The DateTimeOffset to convert. |
Returns
Type | Description |
---|---|
Instant | An Instant value representing the same instant in time as dateTimeOffset . |
Remarks
This is a convenience method which calls FromDateTimeOffset(DateTimeOffset).
ToOffsetDateTime(DateTimeOffset)
Converts a System.DateTimeOffset to OffsetDateTime.
Since 2.0.x
Availability net45, netstandard1.3
Declaration
public static OffsetDateTime ToOffsetDateTime(this DateTimeOffset dateTimeOffset)
Parameters
Type | Name | Description |
---|---|---|
DateTimeOffset | dateTimeOffset | The DateTimeOffset to convert. |
Returns
Type | Description |
---|---|
OffsetDateTime | A new OffsetDateTime with the same values as dateTimeOffset . |
Remarks
This is a convenience method which calls FromDateTimeOffset(DateTimeOffset).
ToZonedDateTime(DateTimeOffset)
Converts a System.DateTimeOffset to ZonedDateTime.
Since 2.0.x
Availability net45, netstandard1.3
Declaration
public static ZonedDateTime ToZonedDateTime(this DateTimeOffset dateTimeOffset)
Parameters
Type | Name | Description |
---|---|---|
DateTimeOffset | dateTimeOffset | The DateTimeOffset to convert. |
Returns
Type | Description |
---|---|
ZonedDateTime | A new ZonedDateTime with the same values as dateTimeOffset ,
using a fixed-offset time zone. |
Remarks
This is a convenience method which calls FromDateTimeOffset(DateTimeOffset).