Show / Hide Table of Contents

Class DateTimeTypeConverter

Provides a converter to convert System.DateTime objects to and from other representations.

Inheritance
System.Object
System.ComponentModel.TypeConverter
DateTimeTypeConverter
Inherited Members
System.ComponentModel.TypeConverter.CanConvertFrom(System.Type)
System.ComponentModel.TypeConverter.CanConvertTo(System.Type)
System.ComponentModel.TypeConverter.ConvertFrom(System.Object)
System.ComponentModel.TypeConverter.ConvertFromInvariantString(System.ComponentModel.ITypeDescriptorContext, System.String)
System.ComponentModel.TypeConverter.ConvertFromInvariantString(System.String)
System.ComponentModel.TypeConverter.ConvertFromString(System.ComponentModel.ITypeDescriptorContext, System.Globalization.CultureInfo, System.String)
System.ComponentModel.TypeConverter.ConvertFromString(System.ComponentModel.ITypeDescriptorContext, System.String)
System.ComponentModel.TypeConverter.ConvertFromString(System.String)
System.ComponentModel.TypeConverter.ConvertTo(System.Object, System.Type)
System.ComponentModel.TypeConverter.ConvertToInvariantString(System.ComponentModel.ITypeDescriptorContext, System.Object)
System.ComponentModel.TypeConverter.ConvertToInvariantString(System.Object)
System.ComponentModel.TypeConverter.ConvertToString(System.ComponentModel.ITypeDescriptorContext, System.Globalization.CultureInfo, System.Object)
System.ComponentModel.TypeConverter.ConvertToString(System.ComponentModel.ITypeDescriptorContext, System.Object)
System.ComponentModel.TypeConverter.ConvertToString(System.Object)
System.ComponentModel.TypeConverter.CreateInstance(System.Collections.IDictionary)
System.ComponentModel.TypeConverter.CreateInstance(System.ComponentModel.ITypeDescriptorContext, System.Collections.IDictionary)
System.ComponentModel.TypeConverter.GetConvertFromException(System.Object)
System.ComponentModel.TypeConverter.GetConvertToException(System.Object, System.Type)
System.ComponentModel.TypeConverter.GetCreateInstanceSupported()
System.ComponentModel.TypeConverter.GetCreateInstanceSupported(System.ComponentModel.ITypeDescriptorContext)
System.ComponentModel.TypeConverter.GetProperties(System.ComponentModel.ITypeDescriptorContext, System.Object)
System.ComponentModel.TypeConverter.GetProperties(System.ComponentModel.ITypeDescriptorContext, System.Object, System.Attribute[])
System.ComponentModel.TypeConverter.GetProperties(System.Object)
System.ComponentModel.TypeConverter.GetPropertiesSupported()
System.ComponentModel.TypeConverter.GetPropertiesSupported(System.ComponentModel.ITypeDescriptorContext)
System.ComponentModel.TypeConverter.GetStandardValues()
System.ComponentModel.TypeConverter.GetStandardValues(System.ComponentModel.ITypeDescriptorContext)
System.ComponentModel.TypeConverter.GetStandardValuesExclusive()
System.ComponentModel.TypeConverter.GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext)
System.ComponentModel.TypeConverter.GetStandardValuesSupported()
System.ComponentModel.TypeConverter.GetStandardValuesSupported(System.ComponentModel.ITypeDescriptorContext)
System.ComponentModel.TypeConverter.IsValid(System.ComponentModel.ITypeDescriptorContext, System.Object)
System.ComponentModel.TypeConverter.IsValid(System.Object)
System.ComponentModel.TypeConverter.SortProperties(System.ComponentModel.PropertyDescriptorCollection, System.String[])
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: System.Windows.Controls
Assembly: OpenSilver.Controls.dll
Syntax
public class DateTimeTypeConverter : TypeConverter

Constructors

| Improve this Doc View Source

DateTimeTypeConverter()

Initializes a new instance of the DateTimeTypeConverter class.

Declaration
public DateTimeTypeConverter()

Methods

| Improve this Doc View Source

CanConvertFrom(ITypeDescriptorContext, Type)

Gets a value indicating whether it is possible to convert the specified type to a System.DateTime with the specified format context.

Declaration
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
Parameters
Type Name Description
System.ComponentModel.ITypeDescriptorContext context

The format context that is used to convert the specified type.

System.Type sourceType

The type to convert.

Returns
Type Description
System.Boolean

True if the conversion is possible; otherwise, false.

Overrides
System.ComponentModel.TypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext, System.Type)
| Improve this Doc View Source

CanConvertTo(ITypeDescriptorContext, Type)

Gets a value indicating whether it is possible to convert a System.DateTime to the specified type within the specified format context.

Declaration
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
Parameters
Type Name Description
System.ComponentModel.ITypeDescriptorContext context

The format context that is used to convert.

System.Type destinationType

The type to convert to.

Returns
Type Description
System.Boolean

True if the conversion is possible; otherwise, false.

Overrides
System.ComponentModel.TypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext, System.Type)
| Improve this Doc View Source

ConvertFrom(ITypeDescriptorContext, CultureInfo, Object)

Converts the specified object to a System.DateTime with the specified culture with the specified format context.

Declaration
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
Parameters
Type Name Description
System.ComponentModel.ITypeDescriptorContext context

The format context that is used to convert the specified type.

System.Globalization.CultureInfo culture

The culture to use for the result.

System.Object value

The value to convert.

Returns
Type Description
System.Object

A System.DateTime object that represents value.

Overrides
System.ComponentModel.TypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext, System.Globalization.CultureInfo, System.Object)
Exceptions
Type Condition
System.FormatException

The conversion cannot be performed.

System.ArgumentNullException

The culture is null.

System.ArgumentNullException

The value is null.

| Improve this Doc View Source

ConvertTo(ITypeDescriptorContext, CultureInfo, Object, Type)

Converts a System.DateTime with the specified culture to the specified object with the specified format context.

Declaration
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
Parameters
Type Name Description
System.ComponentModel.ITypeDescriptorContext context

The format context that is used to convert to the specified type.

System.Globalization.CultureInfo culture

The culture to use for the converting date.

System.Object value

The date to convert.

System.Type destinationType

The type to convert to.

Returns
Type Description
System.Object

An object of the specified type that represents value.

Overrides
System.ComponentModel.TypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext, System.Globalization.CultureInfo, System.Object, System.Type)
Exceptions
Type Condition
System.ArgumentNullException

The culture is a null reference (Nothing in Visual Basic).

System.ArgumentNullException

The destinationType is a null reference (Nothing in Visual Basic).

System.NotSupportedException

The value is not a DateTime or the destinationType is not a string.

  • Improve this Doc
  • View Source