Behind the scenes, date/times are really numbers. They are decimal
numbers that represent the number of days that have passed since a given
starting date. This starting date, the zero date, is different in SQL
than it is in Coldfusion, but the theory still holds. 

One day = 1 
Two days = 2

One and a half days = 1.5
One and a quarter days = 1.25

If you play around with CreateTimeSpan() in ColdFusion, you will see
this. CreateTimeSpan( 1, 0, 0, 0 ) === 1. 

So, by adding one to a date, you are adding a single day (since you are
adding one to the underlying decimal value). 

Here are some related links if you are interested:

http://www.bennadel.com/blog/226-ColdFusion-Date-Math-Faster-Than-Date-M
ethods-And-Other-Date-Math-Ramblings.htm

http://www.bennadel.com/blog/311-Ask-Ben-Looping-Through-The-Days-In-A-M
onth.htm

http://www.bennadel.com/blog/285-Caution-ColdFusion-Zero-Date-vs-SQL-Zer
o-Date.htm


Cheers!


......................
Ben Nadel
Certified Advanced ColdFusion MX7 Developer
www.bennadel.com
 
Need ColdFusion Help?
www.bennadel.com/ask-ben/

-----Original Message-----
From: Chad Gray [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 03, 2007 10:41 AM
To: CF-Talk
Subject: RE: SQL question

On the (@date + 1) how do you know it is adding one day?

Out of curiosity how do you add one year?

Thanks for the clean elegant solution.  I will try it out.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & 
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:274436
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to