Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class Microsoft.​IdentityModel.​Tokens.​DateTimeUtil
Assembly: Microsoft.IdentityModel.Tokens
Inheritance: object → DateTimeUtil
Utility class for performing operations involving <see cref="T:System.DateTime" /> and <see cref="T:System.TimeSpan" /> .
Methods
public static
System.​DateTime
Add​(System.​DateTime time,
System.​TimeSpan timespan)
Adds a <see cref="T:System.DateTime" /> and a <see cref="T:System.TimeSpan" /> .
If the resulting value exceeds <see cref="F:System.DateTime.MaxValue" /> , returns <see cref="F:System.DateTime.MaxValue" /> .
If the resulting value is less than <see cref="F:System.DateTime.MinValue" /> , returns <see cref="F:System.DateTime.MinValue" /> .
Returns The sum of <paramref name="time" /> and <paramref name="timespan" /> , or <see cref="F:System.DateTime.MaxValue" /> if the sum exceeds it, or <see cref="F:System.DateTime.MinValue" /> if the sum is less than it.
time
Initial <see cref="T:System.DateTime" /> value.
timespan
<see cref="T:System.TimeSpan" /> to add.
public static
System.​DateTime
GetMaxValue​(System.​DateTimeKind kind)
Gets the maximum value for a <see cref="T:System.DateTime" /> with the specified <see cref="T:System.DateTimeKind" /> .
Returns The maximum <see cref="T:System.DateTime" /> value of the specified kind.
kind
The <see cref="T:System.DateTimeKind" /> .
public static
System.​DateTime
GetMinValue​(System.​DateTimeKind kind)
Gets the minimum value for a <see cref="T:System.DateTime" /> with the specified <see cref="T:System.DateTimeKind" /> .
Returns The minimum <see cref="T:System.DateTime" /> value of the specified kind.
kind
The <see cref="T:System.DateTimeKind" /> .
public static
System.​DateTime?
ToUniversalTime​(System.​DateTime? value)
Converts the specified <see cref="T:System.DateTime" /> to UTC if it is not already in UTC.
Returns The converted <see cref="T:System.DateTime" /> in UTC, or null if <paramref name="value" /> is null.
value
The <see cref="T:System.DateTime" /> to convert.
public static
System.​DateTime
ToUniversalTime​(System.​DateTime value)
Converts the specified <see cref="T:System.DateTime" /> to UTC if it is not already in UTC.
Returns The converted <see cref="T:System.DateTime" /> in UTC.
value
The <see cref="T:System.DateTime" /> to convert.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object