Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET 3.5 SP1 Edition: In C# and VB
This is the forum to discuss the Wrox book Professional ASP.NET 3.5 SP1 Edition: In C# and VB by Bill Evjen, Scott Hanselman, and Devin Rader; ISBN: 9780470478264
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 3.5 SP1 Edition: In C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 5th, 2012, 10:21 AM
Registered User
Points: 13, Level: 1
Points: 13, Level: 1 Points: 13, Level: 1 Points: 13, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Cool 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.

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);

Last edited by ltimms; April 5th, 2012 at 10:27 AM.. Reason: To add the chapter I am having the problem with
  #2 (permalink)  
Old March 25th, 2014, 05:04 PM
Friend of Wrox
Points: 528, Level: 8
Points: 528, Level: 8 Points: 528, Level: 8 Points: 528, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2014
Posts: 136
Thanks: 1
Thanked 10 Times in 10 Posts
Default

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
String was not recognized as valid datetime thillaiarasu Visual Studio 2005 2 November 2nd, 2007 05:19 AM
Cast from string to type Double not valid mika27 ASP.NET 2.0 Basics 0 January 31st, 2007 05:52 AM
How to convert a string in DateTime elena SQL Language 6 March 29th, 2006 06:59 PM
Err: Cast from String "" to type byte is not valid Parbish BOOK: Beginning VB.NET Databases 1 July 9th, 2005 05:43 PM
Cast from string "" to type 'Integer' is not valid h3x SQL Server ASP 1 January 30th, 2005 09:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.