Share via


ToString Method (String)

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Converts the value of the current DateTime object to its equivalent string representation using the specified format.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Function ToString ( _
    format As String _
) As String
public string ToString(
    string format
)
public:
String^ ToString(
    String^ format
)
member ToString : 
        format:string -> string 
public function ToString(
    format : String
) : String

Parameters

Return Value

Type: System. . :: . .String
A string representation of value of the current DateTime object as specified by format.

Remarks

The format parameter should contain either a single format specifier character (see Standard Date and Time Format Strings) or a custom format pattern (see Custom Date and Time Format Strings) that defines the format of the returned string. If format is null Nothing nullptr unit a null reference (Nothing in Visual Basic) or an empty string, the general format specifier, 'G', is used.

.NET Framework Security

See Also

Reference

DateTime Structure

ToString Overload

System Namespace