473,396 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Choise date BETWEEN 2 dates from SQL table

Hello!
I have got problem with date in SQL query. I would like choise date bettwen 2 dates for example SQL query
Expand|Select|Wrap|Line Numbers
  1. select * from news WHERE data BETWEEN 24-07-2007 AND  06-08-2007
In SQL working but when i use Cold Fusion my query is still wrong
Expand|Select|Wrap|Line Numbers
  1. <cfset today = Now()>
  2. <cfoutput>#DateFormat(today, "dd-mmm-yyyy")#</cfoutput>
  3. <cfquery name="News" datasource="#DSNname#">
  4. SELECT * FROM News WHERE Date = #DateFormat(today, "dd-mmm-yyyy")#</cfquery>
I try a lot of way change WHERE Date = #DateFormat(today, "dd-mmm-yyyy")# but nothing working. Maybe somebody can help me??
Jul 24 '07 #1

✓ answered by improvcornartist

Have you tried using #DateFormat(today, "yyyy-mm-dd")#? If that doesn't work, you might try something like
Expand|Select|Wrap|Line Numbers
  1. <CFSET new_date =#CREATEODBCDATETIME("7/24/2007")#>
and use it in the query instead of DateFormat.

Also, the problem may only be that you are referencing the table column by Date, which might be reserved and thus could cause errors.

2 6206
improvcornartist
303 Expert 100+
Have you tried using #DateFormat(today, "yyyy-mm-dd")#? If that doesn't work, you might try something like
Expand|Select|Wrap|Line Numbers
  1. <CFSET new_date =#CREATEODBCDATETIME("7/24/2007")#>
and use it in the query instead of DateFormat.

Also, the problem may only be that you are referencing the table column by Date, which might be reserved and thus could cause errors.
Jul 24 '07 #2
Expand|Select|Wrap|Line Numbers
  1. <CFSET new_date =#CREATEODBCDATETIME("7/24/2007")#>
Also, the problem may only be that you are referencing the table column by Date, which might be reserved and thus could cause errors.
Thank a lots made:) It's working. I must use ]
Expand|Select|Wrap|Line Numbers
  1. <CFSET new_date =#CREATEODBCDATETIME("7/24/2007")#>
and later its ok:) I find later something interesting about format data in Cold Fusion
http://www.school-for-champions.com/...sion/dates.htm
but your replay help me. Thanks again.
Jul 25 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Colin Steadman | last post by:
I'm a stupid ASP programmer and I dont do Javascript (except for very simple tasks anyway), and I'm in a bit of a predicament. I've used a javascript table sorting script from here: ...
2
by: Douglas | last post by:
I have a Vehicle MOT field in my table which i have as a Date field I dont really want to hold the year, just 'dd mmm' as MOTs are the same date every year. I have the field on my form as a...
5
by: Alicia | last post by:
Yes, but will that skip a week and group by the date for me? I basically wanted something that would do a count of the dates, then group them by their week name.. BEFORE: Resource Date ...
3
by: Lyn | last post by:
Hi, I am developing a project in which I am checking for records with overlapping start/end dates. Record dates must not overlap date of birth, date of death, be in the future, and must not...
3
by: www.ttdown.com | last post by:
Each day a user is supposed to import a list of information into a database table. The user only has 30 days to import this information. After 30 days the information is lost. I need to be able...
9
by: newtophp2000 | last post by:
I need to add the ability for the users to select a date on one of our web pages. The examples I was given by some users were in JavaScript. Is there a free date picker that I can use? I saw one...
3
by: rugger81 | last post by:
I am currently working in the sql server 2000 environment and I want to write a function to pull all dates within a given date range. I have created several diferent ways to do this but I am...
7
by: No bother | last post by:
I have a table which has, among other fields, a date field. I want to get a count of records where certain criteria are met for, say, three days in a row. For example: NumWidgets Date...
4
by: OzNet | last post by:
I have some functions to calculate the working days in a given period. This includes a table that is queried to calculate the number of public holidays that don’t occur on a weekend. If I test...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.