Class DateTimeExtensions
Extension methods for System.DateTime .
Since 2.0.x
Availability net45, netstandard1.3
Inheritance
Object
DateTimeExtensions
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 DateTimeExtensions
Methods
ToInstant(DateTime)
Since 2.0.x
Availability net45, netstandard1.3
Declaration
public static Instant ToInstant(this DateTime dateTime)
Parameters
Type | Name | Description |
---|---|---|
Date |
dateTime | The DateTime to convert. |
Returns
Remarks
This is a convenience method which calls FromDateTimeUtc(DateTime) .
Exceptions
Type | Condition |
---|---|
Argument |
dateTime does not have a kind of Utc . |
ToLocalDateTime(DateTime)
Converts a System.DateTime of any kind to LocalDateTime .
Since 2.0.x
Availability net45, netstandard1.3
Declaration
public static LocalDateTime ToLocalDateTime(this DateTime dateTime)
Parameters
Type | Name | Description |
---|---|---|
Date |
dateTime | The DateTime to convert. |
Returns
Type | Description |
---|---|
Local |
A new LocaldateTime . |
Remarks
This is a convenience method which calls FromDateTime(DateTime) .