Solved

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

Posted on 2011-09-08
1
159 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
Comment Utility

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 your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now