By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,484 Members | 1,041 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,484 IT Pros & Developers. It's quick & easy.

White space issue when parsing datetime Options

P: n/a
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

Jun 8 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Are you saying that you want the parsing to fail in that situation?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"parez" <ps*****@gmail.comwrote in message
news:11**********************@p77g2000hsh.googlegr oups.com...
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
Jun 9 '07 #2

P: n/a
Sorry about that!!
Yes i am saying it should fail
On Jun 9, 3:53 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Are you saying that you want the parsing to fail in that situation?

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com"parez" <psaw...@gmail.comwrote in message

news:11**********************@p77g2000hsh.googlegr oups.com...
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- Hide quoted text -

- Show quoted text -

Jun 11 '07 #3

P: n/a
AllowWhiteSpace means "be flexible with whitespace". Remove that option.

"parez" <ps*****@gmail.comwrote in message
news:11**********************@p77g2000hsh.googlegr oups.com...
Sorry about that!!
Yes i am saying it should fail
On Jun 9, 3:53 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
> Are you saying that you want the parsing to fail in that situation?

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com"parez" <psaw...@gmail.com>
wrote in message

news:11**********************@p77g2000hsh.googleg roups.com...
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- Hide quoted text -

- Show quoted text -

Jun 11 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.