String was not recognized as a valid DateTime

Discussion in 'Databases' started by abdu123, Feb 11, 2007.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. hi iam using asp.net as the following :

    dim t1="10/2/2007"

    dim dat=


    Convert.ToDateTime(t1).ToString("MM/dd/yyyy")


    also i try


    dim dat =


    Convert.ToDateTime(f1).ToString("yyyy/MM/dd")


    it is not working
     
  2. What is not working? Are you getting an error message? What is your result?

    I did this...

    Dim t1 As String = "10/2/2007"
    Dim dat As String = Convert.ToDateTime(t1).ToString("MM/dd/yyyy")
    Response.Output.WriteLine("dat = {0}", dat)



    and got this response...


    dat = 10/02/2007


    I also did this...


    Dim t1 As String = "10/2/2007"
    Dim dat As String = Convert.ToDateTime(t1).ToString("yyyy/MM/dd")
    Response.Output.WriteLine("dat = {0}", dat)


    and got this response...dat = 2007/10/02





    Joel Thoms
    DiscountASP.NET
    http://www.DiscountASP.NET
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page