[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

System.FormatException: The ERROR -> string was not recognized as a valid DateTime. There is an unknown word starting at index 2.

Posted on 2014-02-11
2
Medium Priority
?
1,839 Views
Last Modified: 2014-02-28
Hi im trying to convert a string into date time like so
Dim dtTime As DateTime = Convert.ToDateTime(div.selectSingleNode(kickofftime).InnerText)

Open in new window


But im getting the error  System.FormatException: The string was not recognized as a valid DateTime. There is an unknown word starting at index 2.

Below is the list of times im trying to change - i believe it could be the ones that say tomorrow in the text?!?!?!?

13:30
14:00
14:45
14:45
14:45
16:30
Tomorrow 14:45
Tomorrow 14:45
0
Comment
Question by:runnerjp2005
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 2000 total points
ID: 39850966
You cannot convert "Tomorrow" in a Convert.ToDateTame. You need a date.

I do not know where you get your information, but "Tomorrow" should be replaced by something like

Cstr(Date.Today.AddDays(1)).ToString
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39850975
The word "Tomorrow" isn't valid as a DateTime component in .NET. .NET does not have PHP's flexibility when it comes to date parsing--at least not built into the Framework. To get this kind of functionality, you will need to employ a 3rd-party library (or write your own). I recall seeing such a library some time back, but I'm having trouble locating it. I'll dig around a bit more.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question