|
Thread: SQL
-
Dec 12th, 1999, 04:31 PM
#1
Thread Starter
Lively Member
Hi,
I have a date problem with a SQL statement.
example
Dim MyDate1 as date
Dim MyDate2 as date
MyDate1 = "09/12/99"
Mydate1 = Format(MyDate1, "DD/MM/YY")
MyDate2 = (MyDate1 + 3)
Mydate2 = Format(MyDate2, "DD/MM/YY")
Then I write an SQL (Select * from ... between MyDate1 and MyDate2)statement that selects a recordset between the 2 dates, but I always get a recordset that begins at 12/09/99
(12 september 1999).
Why does this happen ?
R@emdonck
-
Dec 12th, 1999, 04:41 PM
#2
Lively Member
I had a similar problem not too long ago.
Even though the date format of the SQL Server database was set as UK format, when the 'dd' section was 12 or less, the database would assume I had entered a US format date.
To get round this try formatting the date as dd/mmm/yy.
Code:
myDate1 = Format(myDate1, "dd/mmm/yy")
------------------
Ishamel
[email protected]
-
Dec 12th, 1999, 09:01 PM
#3
New Member
If you have msaccess, you can make your one query, just make a new query and select SQL under view. Tada! your SQL statement
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|