.NET Framework Class Library XmlConvert..::.ToDateTime Method (String, String)
Namespace:
System.Xml
Assembly:
System.Xml (in System.Xml.dll)

Syntax
Public Shared Function ToDateTime ( _
s As String, _
format As String _
) As DateTime
public static DateTime ToDateTime(
string s,
string format
)
public:
static DateTime ToDateTime(
String^ s,
String^ format
)
static member ToDateTime :
s:string *
format:string -> DateTime
Parameters- s
- Type: System..::.String
The string to convert.
- format
- Type: System..::.String
The format structure to apply to the converted DateTime. Valid formats include "yyyy-MM-ddTHH:mm:sszzzzzz" and its subsets. The string is validated against this format.

Exceptions
| Exception | Condition |
|---|
| ArgumentNullException |
s is nullNothingnullptra null reference (Nothing in Visual Basic). | | FormatException |
s or format is String.Empty -or-
s does not contain a date and time that corresponds to format. |

Version Information
.NET FrameworkSupported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0 .NET Framework Client ProfileSupported in: 4, 3.5 SP1

Platforms
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

See Also
|
.NET Framework-Klassenbibliothek XmlConvert..::.ToDateTime-Methode (String, String)
Namespace:
System.Xml
Assembly:
System.Xml (in System.Xml.dll)

Syntax
Public Shared Function ToDateTime ( _
s As String, _
format As String _
) As DateTime
public static DateTime ToDateTime(
string s,
string format
)
public:
static DateTime ToDateTime(
String^ s,
String^ format
)
static member ToDateTime :
s:string *
format:string -> DateTime
Parameter- s
- Typ: System..::.String
Die zu konvertierende Zeichenfolge.
- format
- Typ: System..::.String
Die auf das konvertierte DateTime anzuwendende Formatstruktur. Ein gültiges Format ist yyyy-MM-ddTHH:mm:sszzzzzz und die Teilmengen davon. Es wird überprüft, ob die Zeichenfolge dieses Format aufweist.

Ausnahmen
| Ausnahme | Bedingung |
|---|
| ArgumentNullException |
s hat den Wert nullNothingnullptrNULL-Verweis (Nothing in Visual Basic). | | FormatException |
s oder format ist String.Empty. – oder –
s enthält kein Datum und keine Uhrzeit, die format entsprechen. |

Versionsinformationen
.NET FrameworkUnterstützt in: 4, 3.5, 3.0, 2.0, 1.1, 1.0 .NET Framework Client ProfileUnterstützt in: 4, 3.5 SP1

Plattformen
Windows 7, Windows Vista SP1 oder höher, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core wird nicht unterstützt), Windows Server 2008 R2 (Server Core wird mit SP1 oder höher unterstützt), Windows Server 2003 SP2
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.

Siehe auch
|