Adding Numbers To Date/Time Values
Posted August 4, 2006 at 2:25 PM
Ok ok, last SQL date/time post I swear. But, while testing my last entry idea, I realized you can add numbers to your date/time values. Wicked cool:
Launch code in new window » Download code as text file »
- SELECT
- -- Query for yesterday's date.
- (
- getDate() - 1
- ) AS yesterday,
-
- -- Query for tomorrow's date.
- (
- getDate() + 1
- ) AS tomorrow
Just note that this leaves in the TIME value as-is.
Download Code Snippet ZIP File
Post Comment | Ask Ben | Permalink | Print Page
Newer Post
ColdFusion Query Error: Value Can Not Be Converted To Requested Type
Older Post
SQL Date/Time BETWEEN And Comparison Operators Work With Floats
Reader Comments
There are no comments posted for this web log entry.




