Hi 451ls,
you can use this one too. but pls try the suggestion of createodbcdate first.
#CreateODBCDate(yourDate)#
Regards,
---Pinal
Main Topics
Browse All TopicsIf I do a query of a SQL 'smalldatetime' column, this is the format I get:
DateBegin -> 2004-06-21 08:51:00
Here are the form select fields to get the dates I will compare to it. These values
are from a query of the same columns, same datatype:
<select name="beginsurvey">
<option value="#DateBegin#">#DateF
.
<select name="endsurvey">
<option value="#DateBegin#">#DateF
Here's the key part of the query:
WHERE DateBegin BETWEEN #form.beginsurvey# AND #form.endsurvey#
But my query does not provide the desired results because I don't want the
hh:mm:ss portion to be part of the comparison. So a form date of 2004-06-21 9:51:00
or 2004-06-21 07:51:00 would both return true.
I've tried DateFormat and with and without single quotes - but don't really understand
what I am supposed to do. I think it changes the data type. Not sure.
Thanks in advance.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Not yet - here is my WHERE clause:
WHERE CONVERT(DateBegin AS SMALLDATETIME, 103) BETWEEN #dateFormat(form.beginsurv
The error is:
[Macromedia][SQLServer JDBC Driver][SQLServer]Incorrec
7 : WHERE CONVERT(DateBegin AS SMALLDATETIME, 103) BETWEEN #dateFormat(form.beginsurv
8 : AND SF.ProgramID IN (#pgmid#)
my WHERE clause:
WHERE CONVERT(DateBegin, SMALLDATETIME, 103) BETWEEN #dateFormat(form.beginsurv
The error:
[Macromedia][SQLServer JDBC Driver][SQLServer]Invalid column name 'SMALLDATETIME'.
7 : WHERE CONVERT(DateBegin, SMALLDATETIME, 103) BETWEEN #dateFormat(form.beginsurv
8 : AND SF.ProgramID IN (#pgmid#)
That gets rid of the errors but returns no results.
I did this to find out what this CONVERT was doing:
SELECT CONVERT(SMALLDATETIME, DateBegin, 103)
and I get exactly what I had before without using the convert: 2004-06-21 08:51:00
I thought this was supposed to convert it to a format without hh:mm:ss included.
Let's see if there is a way to see what the convert does.
I entered this in SQL Query Analyzer: SELECT CONVERT(SMALLDATETIME, DateBegin, 103)
but the output is always the same, regardless of the style.
Does SQL Query Analyzer not display the way it is converted?
Tacobell777 - this problem of getting a date to a yy-mm-dd format that can be compared
to other date values can't be that hard. I don't want to construct the entire string as casted
charactrers.
nick
Business Accounts
Answer for Membership
by: pinaldavePosted on 2004-06-30 at 22:30:08ID: 11443608
Hi 451ls,
(yourDate) , "mmmm d, yyyy")#
you have done everything correct. I do not know why it should not work.
Though just for trouble shooting purpose run this
try LSDateFormat(DateBegin, 'medium')
also try this #DateFormat(CreateODBCDate
and let me know. I think the problem is createodbcdate.
Regards,
---Pinal