Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > Visual Studio 2005
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 1st, 2007, 09:39 AM
Authorized User
 
Join Date: Aug 2006
Location: chennai, tamilnadu, India.
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
Reply With Quote
  #2 (permalink)  
Old November 1st, 2007, 09:45 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
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
================================================== =========
Reply With Quote
  #3 (permalink)  
Old November 2nd, 2007, 06:19 AM
Authorized User
 
Join Date: Aug 2006
Location: chennai, tamilnadu, India.
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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 22nd, 2005 12:09 AM
Err: Cast from String "" to type byte is not valid Parbish BOOK: Beginning VB.NET Databases 1 July 9th, 2005 06: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 05:31 PM



All times are GMT -4. The time now is 05:01 AM.


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