By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,687 Members | 2,028 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,687 IT Pros & Developers. It's quick & easy.

date based criteria

P: n/a
got another one for you guys out there, and thanks again for the help
with my "counting question"

this time i'm looking to select records based on date, the database
stores the date as mm/dd/yyyy time am/pm ie: 08/11/2004 2:42:28 PM and
unfortunately the field is called date

this much I know if i want to select based on date:

select from table where [date]=

it's my understanding that i need to put the name of the date field in
[] in order to prevent it from confusing it with functions etc...
however my problem is this

how do i get it to select records from the month of december i have
tried [date]='12/*/2004' and [date]='::12/*/2004::' and many other
variants that i have read about on various web sites, but it never seems
to work once again the answer is probably not as complicated as i
believe it to be, but i just can't seem to find the right answers when i
hit the search engines, so if someone can explain how this should be
done, that would be greatly appreciated

thanks
Jul 22 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
C White wrote:
got another one for you guys out there, and thanks again for the help
with my "counting question"

this time i'm looking to select records based on date, the database
What database? It's always relevant. Type and version.
stores the date as mm/dd/yyyy time am/pm ie: 08/11/2004 2:42:28 PM and
Unless the field is a character field, the datetime is NOT stored like that.
it may be displayed like that, but it is not stored that way. The details of
how it is stored depends on the database.
unfortunately the field is called date
Yes, that is bad.

this much I know if i want to select based on date:

select from table where [date]=

it's my understanding that i need to put the name of the date field in
[] in order to prevent it from confusing it with functions etc...
Correct, unless you can change the name of the field. More reserved keywords
can be found here:
http://www.aspfaq.com/show.asp?id=2080
however my problem is this

how do i get it to select records from the month of december i have
tried [date]='12/*/2004' and [date]='::12/*/2004::' and many other
variants that i have read about on various web sites, but it never
seems to work once again the answer is probably not as complicated as
i believe it to be, but i just can't seem to find the right answers
when i hit the search engines, so if someone can explain how this
should be done, that would be greatly appreciated

Again, it depends on the database, but basically you want to do something
like:

where [date] >= Dec.1 and [date] <= Dec 31

Now the dates will not look like that. I can't tell you how to specify the
dates until you tell us what database you are using. In the meantime, read
up on dates here:

http://www.aspfaq.com/show.asp?id=2313 vbscript
http://www.aspfaq.com/show.asp?id=2040 help with dates
http://www.aspfaq.com/show.asp?id=2260 dd/mm/yyy confusion

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #2

P: n/a
Bob Barrows [MVP] wrote:
C White wrote:
got another one for you guys out there, and thanks again for the help
with my "counting question"

this time i'm looking to select records based on date, the database

What database? It's always relevant. Type and version.

stores the date as mm/dd/yyyy time am/pm ie: 08/11/2004 2:42:28 PM and

Unless the field is a character field, the datetime is NOT stored like that.
it may be displayed like that, but it is not stored that way. The details of
how it is stored depends on the database.

unfortunately the field is called date

Yes, that is bad.

this much I know if i want to select based on date:

select from table where [date]=

it's my understanding that i need to put the name of the date field in
[] in order to prevent it from confusing it with functions etc...

Correct, unless you can change the name of the field. More reserved keywords
can be found here:
http://www.aspfaq.com/show.asp?id=2080

however my problem is this

how do i get it to select records from the month of december i have
tried [date]='12/*/2004' and [date]='::12/*/2004::' and many other
variants that i have read about on various web sites, but it never
seems to work once again the answer is probably not as complicated as
i believe it to be, but i just can't seem to find the right answers
when i hit the search engines, so if someone can explain how this
should be done, that would be greatly appreciated


Again, it depends on the database, but basically you want to do something
like:

where [date] >= Dec.1 and [date] <= Dec 31

Now the dates will not look like that. I can't tell you how to specify the
dates until you tell us what database you are using. In the meantime, read
up on dates here:

http://www.aspfaq.com/show.asp?id=2313 vbscript
http://www.aspfaq.com/show.asp?id=2040 help with dates
http://www.aspfaq.com/show.asp?id=2260 dd/mm/yyy confusion

Bob Barrows

it's an access 2000 database, unfortunately i can't get them to change
the name of the field

many thanks for the links at first glance they appear to be what i am
looking for
Jul 22 '05 #3

P: n/a
Bob Barrows [MVP] wrote:
C White wrote:
got another one for you guys out there, and thanks again for the help
with my "counting question"

this time i'm looking to select records based on date, the database

What database? It's always relevant. Type and version.

stores the date as mm/dd/yyyy time am/pm ie: 08/11/2004 2:42:28 PM and

Unless the field is a character field, the datetime is NOT stored like that.
it may be displayed like that, but it is not stored that way. The details of
how it is stored depends on the database.

unfortunately the field is called date

Yes, that is bad.

this much I know if i want to select based on date:

select from table where [date]=

it's my understanding that i need to put the name of the date field in
[] in order to prevent it from confusing it with functions etc...

Correct, unless you can change the name of the field. More reserved keywords
can be found here:
http://www.aspfaq.com/show.asp?id=2080

however my problem is this

how do i get it to select records from the month of december i have
tried [date]='12/*/2004' and [date]='::12/*/2004::' and many other
variants that i have read about on various web sites, but it never
seems to work once again the answer is probably not as complicated as
i believe it to be, but i just can't seem to find the right answers
when i hit the search engines, so if someone can explain how this
should be done, that would be greatly appreciated


Again, it depends on the database, but basically you want to do something
like:

where [date] >= Dec.1 and [date] <= Dec 31

Now the dates will not look like that. I can't tell you how to specify the
dates until you tell us what database you are using. In the meantime, read
up on dates here:

http://www.aspfaq.com/show.asp?id=2313 vbscript
http://www.aspfaq.com/show.asp?id=2040 help with dates
http://www.aspfaq.com/show.asp?id=2260 dd/mm/yyy confusion

Bob Barrows

between your example and the links I managed to figure it out:

([Date] >= #12/1/2004# and [Date] <=#12/31/2004#)

gives me everything for december

thanks again, once again it wasn't as hard as i was making it out to be,
once someone who knew what they were doing pointed me in the right direction
Jul 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.