| 
	
 | 
 Posted by laurenq uantrell on 11/29/05 05:32 
I've gotten sort of fed up with dealing with regional date settings on 
the client side and am considering the following scheme - just 
wondering if anyone has a negative view of it or not: 
 
Instead of 
 
@StartDate datetime, 
@EndDate datetime 
 
Use: 
 
@StartDaysDiff int, 
@EndDaysDiff int 
 
 
In the front end app take the desired date and do a DATEDIFF with the 
current date, then pass the date diff as a parameter as an integer 
rather than deal with the dates at all. 
 
Then... 
 
DECLARE @TodayDate datetime, @StartDate datetime, @EndDate datetime 
 
SELECT @TodayDate = GETDATE() 
SELECT @StartDate = DATEDIFF(DAY,@StartDaysDiff,@TodayDate) 
SELECT @EndDate = DATEDIFF(DAY,@EndDaysDiff,@TodayDate) 
 
SELECT 
a.Something 
FROM 
dbo.Appointments a 
WHERE 
a.AppointmentDate BETWEEN @StartDate and @EndDate 
 
Just wondering ... 
 
Thanks, 
lq
 
  
Navigation:
[Reply to this message] 
 |