Convert a string into datetime using c#
Step-1:
First include this namespace
using System.Globalization;
Step-2:
Use the following code.
string date = "19-may-2000";
DateTime datetime = DateTime.ParseExact(date , "dd-MMMM-yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None);
Output:
Result: 19-05-2000
No comments:
Post a Comment