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!

BETWEEN error- format date? 1

Status
Not open for further replies.

Slippenos

MIS
Apr 22, 2005
333
US
How can I take a date

01/09/2005

and convert it to

2005-09-01

I am writing a query and I understand that

BETWEEN '01/09/2005' AND '01/21/2005'

is the wrong format.

Any thoughts?

[blue]Go to work to learn. Don't go to work to earn.[/blue]
 
Replace this:
BETWEEN '01/09/2005' AND '01/21/2005'
with this:
BETWEEN '2005-01-09' AND '2005-01-21'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
The date values are generated by VBScript. Is there any way to convert the '01/09/2005' to '2005-01-09'?

Is '2005-1-9' correct format? If so, I will use the Month, Day, and Year VB functions.

[blue]Go to work to learn. Don't go to work to earn.[/blue]
 
Year(varDate) & "-" & Right("0" & Month(varDate), 2) & "-" & Right("0" & Day(varDate), 2)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Yes, thanks for the help

[blue]Go to work to learn. Don't go to work to earn.[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top