prob with dates.

Results 1 to 3 of 3

Thread: prob with dates.

  1. #1
    Join Date
    Dec 1969

    Default prob with dates.

    hi.<BR> on my database, i have dates stored in the format yyyy-mm-dd. but my user (using a date picker) chooses a date in the dd-mm-yyyy. <BR> i am using a query like<BR>sql="select * from ihtuser where reported_date = &#039;" & vardate "&#039;"<BR><BR> on my asp page i am getting this error<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039;80040e07&#039; <BR><BR>[Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value. <BR> <BR> please help me to how to convert the date entered by a user to query the db.

  2. #2
    Join Date
    Dec 1969

    Default I suggest you pick...

    ...the string apart using VBScript (or JScript if you prefer) and convert it into a yyyy/mm/dd format (I think that&#039;s what SQL server likes). Mid(), Left() and InStr() will all come in handy.<BR><BR>Oliver.

  3. #3
    Join Date
    Dec 1969

    Default RE: prob with dates.

    One thing I have done (and even quite recently) has also been to check my DB tables themselves to ensure that each column that requires a date, is in fact a date/time setup. Otherwise, you will need to input the dates as if they were strings.<BR><BR>Hope I helped.<BR><BR>G3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts