Hi. I am new to coldfusion and was wandering if someone could offer me som advice. I am trying to add the integer value stored in 'PlannedDelivery' to the current date. The example i have in my book is... SELECT DATE_ADD(NOW(), INTERVAL 21 DAY); I want to replace '21' with a variable. This is what i have tried.... SELECT PlannedDelivery (DATE_ADD(NOW(),INTERVAL PlannedDelivery DAY)) AS PlannedDeliveryDate; Is this correct? Should it be INTERVAL '#PlannedDelivery#' DAY ? After i have done this i need to convert the result 'PlannedDeliveryDate' to a datatime data type. Any sugguestions would be greatly appreciated.
Try this: <cfset PlannedDeliveryDay = dateadd("D", + INTERVAL_VARIABLE, NOW())> Code (markup): if that doesnt work then try this: <cfoutput> <cfset var today = #now()#/> <cfset PlannedDeliveryDay = dateadd("D", + INTERVAL_VARIABLE, today)> </cfouput> Code (markup): You can change the "D" to "H" for hour, "M" for minute, "S" for second. "D" is ofcourse for Day. Here a link to the livedocs for all the date functions: http://livedocs.adobe.com/coldfusio...xt=ColdFusion_Documentation&file=00000438.htm One thing to note is that when you use <cfoutput>#now()#</cfouput> is that it will ouput the current time of the server in which you site is hosted. Now For me being on the west coast and my server is on the east I see a three hour time difference. Now this doesnt really mater except for when I show the viewers the time. Its a little tricky with cf to figure out the correct time zome where the user of your site will be. Inother words when you use now() the day could be off because the person could be in a different time zone. More of a problem when you want to show the hour. You can check out this other post. There is some javascript there that can help determine the viewers browser time zone. http://forums.digitalpoint.com/showthread.php?t=480585 Here is another thread that has to do with date add http://forums.digitalpoint.com/showthread.php?t=482479 Good luck,