New to Telerik UI for .NET MAUIStart a free 30-day trial

Converts between DateOnly and DateTime values.

Definition

Namespace:Telerik.Maui.Controls

Assembly:Telerik.Maui.Controls.dll

Syntax:

C#
public class DateOnlyToDateTimeConverter : IValueConverter

Inheritance: objectDateOnlyToDateTimeConverter

Implements: IValueConverter

Constructors

C#
public DateOnlyToDateTimeConverter()

Methods

Converts a DateOnly value to a DateTime.

C#
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Parameters:valueobject

The DateOnly value to convert.

targetTypeType

The type to convert to.

parameterobject

Additional parameter for the conversion.

cultureCultureInfo

The culture to use for the conversion.

Returns:

object

A DateTime with the date from the DateOnly and minimum time, or the original value if not a DateOnly.

Converts a DateTime value back to a DateOnly.

C#
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Parameters:valueobject

The DateTime value to convert back.

targetTypeType

The type to convert back to.

parameterobject

Additional parameter for the conversion.

cultureCultureInfo

The culture to use for the conversion.

Returns:

object

A DateOnly with the date part from the DateTime, or the original value if not a DateTime.