19. september 2001 - 16:18Der er
10 kommentarer og 2 løsninger
search for date and show results
Hi There Im working on a script that does a search of people in my SQL database, the basic search is done but I am having craps loads of problems trying to do a search of the dates in the database
has anybody had any experience with this ? the date comes from an input area and is in the following format
18-08-2001
when it get passed to my search script I request it then run it thru this Function GetMyDate2 GetMyDate2 = FormatDateTime(Keyworda, 1) End Function
the value that then gets inserted into my search script looks like this 20. august 2001
My problem is this If fx I insert this date 20-08-2001 then I get the correct results back
However if i insert this date 20-03-2001 then i get the following error \"Syntax error converting datetime from character string.\"
It only happens when I edit the month ?? Please if anybody has a good idea or has had the same problem and help would be great Thanks Guzzie
Hu there dfens I have tried that already :( It produces the same result. The db is set up as short date dd-mm-yyyy I can allways throw up some source code if it would help my explanation ? Guzzie
guzzie> This question has been brought up a number of times. The correct way to SELECT a date from a SQL database is to you the U.S date format which is MM-DD-YYYY.
For example; SELECT Mydate from myTable where MyDate = #12-31-2001#
Function ConvertDate(MyDate) Dim MyDateArray MyDateArray = Split(MyDate,\".\") ConvertDate = MyDateArray(2) & \"-\" & MyDateArray(1) & \"-\" & MyDateArray(0) End Function
ok thanks guys I will split the points between you 2, terry> thanks for the info about SQL and US date format dfens> thanks for the split function it works just fine PS. dfens you have only \"Kommentar\" on my question and not a \"Svar\" so I cant split the points ? Guzzie
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.