Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
teedah1
Starting Member
10 Posts |
Posted - 2007-10-01 : 17:46:43
|
Hi! how to calculate date 2 and date 1, and display days elpased days betwn these dates. This is in MS SQL. thanks!!!! |
|
Kristen
Test
22859 Posts |
Posted - 2007-10-01 : 17:48:50
|
DATEDIFF(Day, EarlierDateColumn, LaterDateColumn) |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-10-03 : 02:36:21
|
or in .NET, you can do date1-date1 or you can use datediff function available thereMadhivananFailing to plan is Planning to fail |
|
|
teedah1
Starting Member
10 Posts |
Posted - 2007-10-08 : 14:49:33
|
thanks. now the problem is i want to display only days that are elapsed more than 2 day to show up.if i use the datediff(day, ealierdate, laterdate) AS dayslapsedhow to sort the dayslapsed, since this is not really a column?i can't do select *, datediff(day, ealierdate, laterdate) AS dayslapsedfrom mytablewhere dayslapsed > 2 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-10-08 : 15:04:49
|
select *, datediff(day, ealierdate, laterdate) AS dayslapsedfrom mytablewhere datediff(day, ealierdate, laterdate) > 2Kristen |
|
|
|
|
|
|
|