Solved

Need help with running script within certain set parameter X amount of days.

Posted on 2011-09-08
1
165 Views
Last Modified: 2012-05-12
Hello,

I have several dates within a column that I would like to run a script on that will update column based off of the date within the column.

My date looks like this..."2011-06-07 09:02:00" The time doesn't matter so it would be something like...

<cfquery>
UPDATE TABLE
SET columnB = #myNewData#
WHERE LastUpdatedDate = within X amount of days
</cfquery>

I have X date because I want to be able to adjust the days as I need to.

Thx,

Brian
0
Comment
Question by:brihol44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 39

Accepted Solution

by:
gdemaria earned 125 total points
ID: 36510220

when you say within X number of Days, not sure what "within" means - is that X days more than, less than or either side of the date?  And which date?  Today?  Or a date you supply?


This example is X days before a given date up until that date...
<cfset targetDate = "12/15/2002">
<cfset numbDays = 12">

WHERE LastUpdatedDate between #createODBCdate(dateAdd("d",-numbDays,targetDate))# and #createODBCdate(targetDate)#

would give 12/3 through 12/15

This example is the X number of days before today and any day after that...

WHERE LastUpdatedDate >= #createODBCdate(dateAdd("d",numbDays,getDate()))#


0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question