p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   BOOK: Professional ASP.NET 3.5 SP1 Edition: In C# and VB (http://p2p.wrox.com/book-professional-asp-net-3-5-sp1-edition-c-vb-497/)
-   -   String was not recognized as a valid DateTime (http://p2p.wrox.com/book-professional-asp-net-3-5-sp1-edition-c-vb/87184-string-not-recognized-valid-datetime.html)

ltimms April 5th, 2012 10:21 AM

String was not recognized as a valid DateTime
The folllowing line of code gives the error: String was not recognized as a valid DateTime. This happens at runtime, everything compiles with no problem.
I tried substuting DateTime.Now and got the same error. I also tried the commented out solution below, all trials gave the same error. At this point I'm out of ideas.[B)]

P.S. This is from Chapter 9, the Movie class setup. I commented out all the code to focus on getting the first Movie added and have had no luck up to this point.

System.DateTime str_date = DateTime.Parse("15/6/2001");

//System.Globalization.CultureInfo.CreateSpecificCul ture("en_AU").DateTimeFormat);

mmorgan30 March 25th, 2014 05:04 PM

Default date format is MM/dd/yyy, your date sting is dd/MM/yyyy

All times are GMT -4. The time now is 09:17 PM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.