ColdFusion:如何检查提交日期后15天? [英] ColdFusion: how to check 15 days past the submitted date?
问题描述
我在数据库中保存了多个帐户。我想通过电子邮件已经过期15天的accountsdd。换句话说,如果提交的日期(日期格式:mm-dd-yyyy)比今天的日期早15天,那么发送电子邮件。我该怎么做?任何信息,非常感谢。谢谢。
I saved several accounts in the database. I want to email the accountsdd that have been expired for 15 days. In another word, if the submitted day (date format: mm-dd-yyyy) is 15 days older from today's date then send an email. How do I do it? Any info is greatly appreciated. Thank you.
推荐答案
您想要使用 dateDiff
/ p>
you would want to use the dateDiff
function
<cfif dateDiff('d',submittedDate,now()) GT 15>
如果您的日期确实存储为 mm-dd-yyyy
而不是日期/时间对象,那么您将需要使用 createODBCDate
函数
If your date is really stored as mm-dd-yyyy
instead of a date/time object then you would need to use the createODBCDate
function
<cfif dateDiff('d',CreateODBCDate(submittedDate),now()) GT 15>
如果您希望通过查询拉取所有帐户,这将工作。这将在MSSQL上工作
If you're looking to pull all accounts via a query this would work. This would work on MSSQL
SELECT relevant, columns
FROM myTable
WHERE dateDiff(d,submittedDate,getDate()) > 15
这篇关于ColdFusion:如何检查提交日期后15天?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!