Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > Visual Studio 2005
|
Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2005 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
 
Old November 1st, 2007, 08:39 AM
Authorized User
 
Join Date: Aug 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to thillaiarasu
Default String was not recognized as valid datetime

hi every one.In my application. i am getting the error String was not recognized as valid datetime.

If i am compiling my apllication in cache webserver in webdeveloper2005 i am not geting the error.

If iam using my appliation in my pc or in other pc using IIS or apache i am getting the error



my code will looks like this

DateTime str_date = Convert.ToDateTime(sel3.Text);

waiting for ur reply

Thanks in Advance
N.ThillaiArasu


n.thillaiarasu
__________________
N.ThillaiArasu
 
Old November 1st, 2007, 08:45 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

O.o All that i can tell you is that the value of sel3.Text is not a valid datetime. What is the value of sel3?

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor :.
Wrox Books 24 x 7
================================================== =========
 
Old November 2nd, 2007, 05:19 AM
Authorized User
 
Join Date: Aug 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to thillaiarasu
Default

Hi i also had the same problem my applications will be running in localhost but when i use IIS or apache it will throw the error String was not recognized as a valid DateTime.After a lot of search i finally got the solution

just declare ur date field as



System.DateTime str_date=DateTime.Parse(sel3.Text,System.Globaliza tion.CultureInfo.CreateSpecificCulture("en-AU").DateTimeFormat);

I hope it will work fine in ur application

Thanks in Advance,

N.ThillaiArasu,


N.ThillaiArasu





Similar Threads
Thread Thread Starter Forum Replies Last Post
Cast from string to type Double not valid mika27 ASP.NET 2.0 Basics 0 January 31st, 2007 05:52 AM
String to DateTIme for Insert plymnet Classic ASP Databases 1 August 21st, 2005 11:09 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
How to convert a string in DateTime elena ADO.NET 3 July 24th, 2003 04:31 PM





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