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

Datetime Exception

P: n/a
dim d as datetime
d = DateTime.Parse(#6/10/2004 11:50:40 PM#) produces exception "String was
not recognized as a valid DateTime."
d = DateTime.Parse("6/10/2004 11:50:40 PM") is OK
d = DateTime.Parse(#6/10/2004 11:50:40 AM#) is OK
can somebody expain what is wrong with the first statement
I am using VS 2003 with framework version 1.1 sp1
Thanx George

Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"news.microsoft.com" <ge****@hotmail.com> schrieb:
dim d as datetime
d = DateTime.Parse(#6/10/2004 11:50:40 PM#) produces exception "String was
not recognized as a valid DateTime."


Why do you use 'DateTime.Parse' in this case at all? It's not necessary...

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #2

P: n/a
Hello,

Why not make it yourself easy with an always in all regions all languages
all cultures working code
d = DateTime.Parse(#6/10/2004 11:50:40 PM#) produces exception "String was


d = new Date(2004,6,10,11,50,40)

Cor
Nov 21 '05 #3

P: n/a
I downloaded Traker sample application from Infragistics and when I tryed to
execute it I received this error.
I know this is not necessary but the error is weird. Dont you think so too?
Is there somethink wrong with the code becaurse I dont see anything wrong
with the datetime value.
George
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uF*************@TK2MSFTNGP11.phx.gbl...
"news.microsoft.com" <ge****@hotmail.com> schrieb:
dim d as datetime
d = DateTime.Parse(#6/10/2004 11:50:40 PM#) produces exception "String was not recognized as a valid DateTime."
Why do you use 'DateTime.Parse' in this case at all? It's not

necessary...
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>


Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.