Solved

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

Posted on 2011-09-08
1
163 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
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

810 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