I got this error when I was trying to convert date string with format dd/MM/yyyy.
Solution:
First Import below Namespace
Solution:
First Import below Namespace
using System.Globalization;Replace STRDATE with your date. And use any of the below code for conversion.
Datetime DT = DateTime.ParseExact(STRDATE,"dd/MM/yyyy",System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat)OR
DateTime date = DateTime.ParseExact(STRDATE, "dd/MM/yyyy", CultureInfo.InvariantCulture);OR
DateTime date = DateTime.ParseExact(STRDATE, "dd/MM/yyyy", null);
Reference: http://nadarmuthukumar.blogspot.in/
0 comments:
Post a Comment