none
MS SQL server 2000 date format RRS feed

  • Question

  • Hi, I'm using VB .net 2003 and MS SQL server 2000. I have created a table 'Student' with one field 'SDATE' having datatype "DateTime".

    I'm getting a user input of date as "mm/dd/yyyy" format as String format. I have to compare the SDATE database value with user input. Say,

    Dim dt as String

    dt='05/07/2007'

     

    I want to convert 'dt' value as DateTime data type.

    What will be the VB .net code for that?

    Friday, July 6, 2007 6:07 PM

Answers

  • You could use Convert.ToDate(dt) to convert it to the date. It will work if format of the data in your string matches regional settings on your PC. If not, you could construct date from the string using constructor of the DateTime structure.

    Monday, July 9, 2007 10:49 AM
    Moderator