Creates a DateTime from a String.
[Visual Basic] Public Shared Function FromString( _ ByVal s As String _ ) As DateTime [C#] public static DateTime FromString( string s ); [C++] public: static DateTime FromString( String* s ); [JScript] public static function FromString( s : String ) : DateTime;
A new DateTime value.
Exception Type | Condition |
---|---|
ArgumentException | If s is a null reference (in Visual Basic Nothing). |
FormatException | If s does not contain a valid string representation of a date and time. |
The DateTime string must specify a date and, optionally, a time in the format required by the current locale. Use either the universal FromString or locale-specific Parse.
The output of ToString must be consumable by FromString.
DateTime Structure | DateTime Members | System Namespace | String | CultureInfo