Trouble with Date functions

Results 1 to 2 of 2

Thread: Trouble with Date functions

  1. #1
    Join Date
    Dec 1969

    Default Trouble with Date functions

    I have a date stored in MySQL database. It is stored as &#039;2003-05-01&#039;. I am selecting it via query and want to convert it to &#039;mm/dd/yy&#039; using the following code<BR><BR>SaleDate = Month(RS("Sale_Date")) & "/" & Day(RS("Sale_Date")) & "/" & Year(RS("Sale_Date"))<BR><BR>I am getting a Microsoft VBScript runtime error &#039;800a000d&#039; type mismatch error with the &#039;year&#039; portion. if i remove year i get a valid &#039;5/1&#039; string. Why is this happening?

  2. #2
    Join Date
    Dec 1969

    Default RE: Trouble with Date functions

    Why? Not sure.<BR><BR>I would put the sql date into a local variable. You may even want to check if its a "date" (isdate) then do CDATE on it to make sure VBscript understands it.<BR><BR>I hardcoded your date string into vbscript and did the functions just fine.

Posting Permissions

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