date based criteria

C

C White

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
 
B

Bob Barrows [MVP]

C said:
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
 
C

C White

Bob said:
C said:
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
 
C

C White

Bob said:
C said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,265
Messages
2,571,069
Members
48,771
Latest member
ElysaD

Latest Threads

Top