Joutsen v0.5.0+12-g5dd5f7e
Static Public Member Functions | List of all members
Joutsen.DateTimeExtensions Class Reference

A static class containing extensions for the System.DateTime class. More...

Static Public Member Functions

static String ToIso8601LongDateTimeString (this DateTime dateTime)
 Creates a date and time string that conforms to ISO 8601. More...
 
static DateTime ToDateTimeKind (this DateTime dateTime, DateTimeKind kind)
 Converts a datetime to a different kind of datetime. More...
 

Detailed Description

A static class containing extensions for the System.DateTime class.

Since
0.2.0

Member Function Documentation

◆ ToDateTimeKind()

static DateTime Joutsen.DateTimeExtensions.ToDateTimeKind ( this DateTime  dateTime,
DateTimeKind  kind 
)
static

Converts a datetime to a different kind of datetime.

Parameters
dateTimethe System.DateTime object to convert
kindthe kind of datetime to convert into
Returns
a datetime that is converted to the desired kind
Remarks
While the Unspecified kind is supported it returns the exact same time as the input.
Since
Unreleased

◆ ToIso8601LongDateTimeString()

static String Joutsen.DateTimeExtensions.ToIso8601LongDateTimeString ( this DateTime  dateTime)
static

Creates a date and time string that conforms to ISO 8601.

Parameters
dateTimethe System.DateTime object to convert
Returns
a string representation of the dateTime in the format YYYY-MM-DDThh:mm:sszzz
Remarks
the method takes the System.DateTimeKind of the dateTime into account to return the appropriate timezone offset.