Problems with date formats...

Results 1 to 3 of 3

Thread: Problems with date formats...

  1. #1
    Greg Bloxham Guest

    Default Problems with date formats...

    Hi..<BR> Can anyone help me with the following date and sql problem please?<BR>here is some sample code..<BR><BR>response.write "The date is: " & date<BR>response.write "The shortdate is: " & formatdatetime(date, vbshortdate)<BR>Query = "select * from event where end_date=&#039" & date & "&#039"<BR>response.write "The query is: " & query<BR><BR>This is the output...<BR>The date is: 12/18/00<BR>The shortdate is: 18/12/2000<BR>The query is: select * from event where end_date=&#039 18/12/2000&#039 <BR><BR>Simple code, but why does the date revert to a shortdate when it is included in the query?? <BR><BR>When I execute this I get <BR>"[Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value." etc bloody etc...<BR><BR>I could write something to handle this if it occured all of the time, but this problem only occurs randomly - regardless of the setttings on the NT server, or who is logged onto it at the time..<BR><BR>Can anyone help me please?<BR><BR>Regards<BR><BR>Greg<BR><BR><BR><BR>

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default RE: Problems with date formats...

    &#062;The date is: 12/18/00<BR>&#062;The shortdate is: 18/12/2000<BR>&#062;The query is: select * from event where end_date=&#039 18/12/2000&#039 <BR><BR>are you sure this is the output??<BR><BR>How did the "date" change from 12/18/00 to 18/12/2000<BR><BR>secondly why is there a space in your query &#039[space]18/12/2000&#039 <BR><BR>get rid of that space use trim <BR><BR><BR><BR>

  3. #3
    Greg Bloxham Guest

    Default RE: Problems with date formats...

    yeah, thats the output - I had to type it into the message board thingy as I had some other html formatting in there that the message board didnt like, so no copying and pasting. But ignoring that extra space, yes thats the output...<BR><BR>Cheers..<BR><BR>G

Posting Permissions

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