General .NETFor general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.Â Â If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category.
** PLEASE BE SPECIFIC WITH YOUR QUESTION **
When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the General .NET 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
In my windows form application convert from string e.g. "04/30/2005 11:59:00" to datetime work fine but in my windows service convert from string to datetime always convert early string to format "30.4.2005 11:59:00" .
CultureInfo cf=new CultureInfo("en-US");
//yourString is according to en-US format
//if not you will recieve FormatException
//then you can convert every DateTime to string
//according to the culture
ERROR OCCOURED IN:Microsoft.VisualBasic
ERROR DESCRIPTION:Cast from string "03.28.2005 00:00:00" to type 'Date' is not valid.
ERROR DESCRIPTION: at Microsoft.VisualBasic.CompilerServices.DateType.Fr omString(String Value, CultureInfo culture)
at Microsoft.VisualBasic.CompilerServices.DateType.Fr omString(String Value)