C# DateTime Parse(String)
Description
DateTime Parse(String)
converts the string representation
of a date and time to its DateTime equivalent.
Syntax
DateTime.Parse(String)
has the following syntax.
public static DateTime Parse(
string s
)
Parameters
DateTime.Parse(String)
has the following parameters.
s
- A string that contains a date and time to convert.
Returns
DateTime.Parse(String)
method returns An object that is equivalent to the date and time contained in s.
Example
The following code shows how to use DateTime.Parse(String)
method.
using System;/* ww w. j a v a2 s . co m*/
public class IsLeapYear
{
public static void Main()
{
DateTime dt = DateTime.Parse("2012/09/17");
Console.WriteLine(dt);
}
}
The code above generates the following result.