Click or drag to resize

ExtensionToDateWebFormat Method

Date for web formatted (yyyy-MM-dd) for web element "Input".

Namespace:  Velo.Data.Helper
Assembly:  Velo.Data (in Velo.Data.dll) Version: 22.2.10.1 (22.2.10.450)
Syntax
public static string ToDateWebFormat(
	this Nullable<DateTime> pDate
)

Parameters

pDate
Type: SystemNullableDateTime

Return Value

Type: String

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type NullableDateTime. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
Exception Exception message: startIndex cannot be larger than length of string. Parameter name: startIndex.

Gives an empty text return.

Remarks
Declaration statement
Using Velo.Data.Helper

Web browser Edge, Chrome, Opera and Firefox supported value format "yyyy-MM-dd" an example "2020-12-30".

Attribute "DataType" parameter "ErrorMessage" is overwrite by browser.

Attribute "DisplayFormat" parameter "DataFormatString" with value "{0:yyyy-MM-dd}" doesn't works.

Examples
A example using for property return
/// <summary>
/// Date web formatted (yyyy-MM-dd) for web element "Input".
/// </summary>
/// <seealso cref="Velo.Data.Helper.Extension.ToDateWebFormat(DateTime)"/>
public string DateWebFormatted
{
    get { return this.Date.ToDateWebFormat(); }

    set { this.Date = Convert.ToDateTime(value); }
}
See Also