• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

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


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...

SET columnB = #myNewData#
WHERE LastUpdatedDate = within X amount of days

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


1 Solution

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()))#

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now