Converting String to DateTime

asp.net United States
  • 17 years ago

    Dim DateApplied As DateTime
    Dim DataStr As String


    DataStr = Now.ToString("dd/MM/yyyy HHmm")
    DateApplied = Convert.ToDateTime(DataStr)
    txtDate.Text = DateApplied


    When I run this code, an error is displayed "String was not recognized as a valid DateTime." May I know if anyone know what is the problem?

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Programs must be written for people to read, and only incidentally for machines to execute.”