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 |
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-01-07 : 02:28:55
|
Hi, I want to write a query that calculates the difference between a given date and last day of currentdate.egGiven date 15 sep 2004Current date 07 jan 2004I want the number of days between givendate and 31 jan 2004I used DateDiff('d',givendate,(DateAdd('m',1,#31 Jan 2005#), DatePart('d',#31 Jan 2005#)) but it works only the datepart of jan is 28 as last day of february is 28any help?Madhivanan |
|
Stoad
Freaky Yak Linguist
1983 Posts |
Posted - 2005-01-07 : 06:36:51
|
DateDiff("d", "11.01.2005", DateAdd("m", 1, Date) - Day(DateAdd("m", 1, Date))).. and answer is 20..hth |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-01-07 : 06:45:55
|
Thanks stoad. It works wellMadhivanan |
 |
|
|
|
|