New to Telerik UI for ASP.NET Core? Start a free 30-day trial

Extension methods for Date and Time conversions.

Definition

Namespace:Kendo.Mvc.Extensions

Assembly:Kendo.Mvc.dll

Syntax:

C#
public static class DatesExtensions

Inheritance: objectDatesExtensions

Inherited Members object.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Methods

Converts DateTime to DateOnly.

C#
public static DateOnly ToDateOnly(this DateTime value)
Parameters:valueDateTimeReturns:

DateOnly

Converts DateOnly to DateTime.

C#
public static DateTime ToDateTime(this DateOnly value)
Parameters:valueDateOnlyReturns:

DateTime

Converts TimeOnly to DateTime.

C#
public static DateTime ToDateTime(this TimeOnly value)
Parameters:valueTimeOnlyReturns:

DateTime

Converts DateTime to TimeOnly.

C#
public static TimeOnly ToTimeOnly(this DateTime value)
Parameters:valueDateTimeReturns:

TimeOnly

Converts the specified string representation of a date to its DateOnly equivalent and returns a value that indicates whether the conversion succeeded.

C#
public static bool TryParse(this string value, out DateOnly result)
Parameters:valuestringresultDateOnlyReturns:

bool

Converts the specified string representation of a date to its TimeOnly equivalent and returns a value that indicates whether the conversion succeeded.

C#
public static bool TryParse(this string value, out TimeOnly result)
Parameters:valuestringresultTimeOnlyReturns:

bool