Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with the criteria in a query using dates

Status
Not open for further replies.

easycode

Programmer
Jan 28, 2005
195
US

I have some fields in a table:
ref-number, userid,My:Format([DateTimeStamp],'mm/dd/yyyy'), and Description.

when i am using the criteria in the field My: Format...

Between #01/01/2006# And #12/30/2006#

it will display information between January 1 and December 30 is ignoring the year, i have done many test with different dates and i have come with the conclusion that is ignoting the year.

Could anyone advise. Thank you very much!
 
My:Format([DateTimeStamp],'mm/dd/yyyy')
This a text string, not a date ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for replying, could you tell what is the right format for a date.
because i have the field setup for datetime.

04/14/2005 9:00:20 AM

and i only need the date part, not the time, i have a text box where the user types de "from date" and "to date" and the query suppose to filter.

Thanks for your help

 


Date/Time is just a NUMBER like

04/14/2005 9:00:20 AM

is really

38456.37523

The DATE portion is the INTEGER part and the TIME portion is the DECIMAL part.

So Int([MyDateTime]) will return a date only.


Skip,

[glasses] [red]Be Advised![/red] A chicken, who would drag a wagon across the road for 2 cents, is…
POULTRY in motion to PULLET for a PALTRY amount! [tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top