0

I have A html page from where i am sending many data to handler this is a part of my handler

string dob = (context.Request.QueryString["dob"]);
        DateTime dt = DateTime.ParseExact(dob, "dd/MM/yyyy", CultureInfo.InvariantCulture);

here dob contains date of birth in format like 03/25/1993. But while debugging it gives an error "the datetime represented by the string is not supported in calendar system.globalization". EDIT- If i enter 09/09/2014 it gives no error. .error MSG

1 Answers1

2

You specify the format

"dd/MM/yyyy"

and provide data

03/25/1993

25 is not a valid month.

UPDATE

Your comment:

The problem persist, In CHROME when i am using input type = date, it is accepting value in format of mm/dd/yyyy but when it is reaching to handler it is in format yyyy-mm-dd. Its Working fine in IE

According to RFC 3339, Chrome's behavior is correct. The browser is supposed to offer an ISO 8601 date. Wonderful to see that IE is still creating browser inconsistencies.

Have a look at the accepted answer for

Handling browser-specific support of HTML input type="date"

for solving this inconsistency.

Community
  • 1
  • 1
Eric J.
  • 147,927
  • 63
  • 340
  • 553
  • The problem persist, In CHROME when i am using input type = date, it is accepting value in format of mm/dd/yyyy but when it is reaching to handler it is in format yyyy-mm-dd. Its Working fine in IE – Nikhil Srivastava Mar 27 '15 at 17:17