White space issue when parsing datetime Options

P

psawant

Hi All,

i have two accepted formats.


expectedFormats = New String() {"%M/%d/yyyy", "%M/%d/yyyy hh:mm:ss
tt"}


dt = DateTime.ParseExact(txtInpDateString.Text, expectedFormats,
culture.DateTimeFormat,
Globalization.DateTimeStyles.AllowWhiteSpaces)


and i get 05/14/200711:22:33 AM as a valid date. (Note: there is no
space between year and time) and i am pretty sure zero lenght string
is not a white space.


Please help
 
P

PlatinumBay

psawant,

DateTime.ParseEx is used to read a string into a DateTime object. The
example you show is a String so I assume you are doing a dt.ToString with
some output format?


Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top