On Thu, Feb 26, 2009 at 6:12 PM, Matt Jarvis <[email protected]> wrote:
> Got this from some website.  You'd maybe tweak it for your pref on start
> of week (rather than Monday)... pretty self-explanatory if you look at
> the field names...

Nice find.  Definitely worth keeping, thanks!

> SELECT
>
> DATEADD(dd, DATEDIFF(dd, 0, GetDate()), 0) As Today
>
> , DATEADD(wk, DATEDIFF(wk, 0, GetDate()), 0) As ThisWeekStart
>
> , DATEADD(mm, DATEDIFF(mm, 0, GetDate()), 0) As ThisMonthStart
>
> , DATEADD(qq, DATEDIFF(qq, 0, GetDate()), 0) As ThisQuarterStart
>
> , DATEADD(yy, DATEDIFF(yy, 0, GetDate()), 0) As ThisYearStart
>
> , DATEADD(dd, DATEDIFF(dd, 0, GetDate()) + 1, 0) As Tomorrow
>
> , DATEADD(wk, DATEDIFF(wk, 0, GetDate()) + 1, 0) As NextWeekStart
>
> , DATEADD(mm, DATEDIFF(mm, 0, GetDate()) + 1, 0) As NextMonthStart
>
> , DATEADD(qq, DATEDIFF(qq, 0, GetDate()) + 1, 0) As NextQuarterStart
>
> , DATEADD(yy, DATEDIFF(yy, 0, GetDate()) + 1, 0) As NextYearStart
>
> , DATEADD(ms, -3, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) + 1, 0)) As
> TodayEnd
>
> , DATEADD(ms, -3, DATEADD(wk, DATEDIFF(wk, 0, GetDate()) + 1, 0)) As
> ThisWeekEnd
>
> , DATEADD(ms, -3, DATEADD(mm, DATEDIFF(mm, 0, GetDate()) + 1, 0)) As
> ThisMonthEnd
>
> , DATEADD(ms, -3, DATEADD(qq, DATEDIFF(qq, 0, GetDate()) + 1, 0)) As
> ThisQuarterEnd
>
> , DATEADD(ms, -3, DATEADD(yy, DATEDIFF(yy, 0, GetDate()) + 1, 0)) As
> ThisYearEnd

-- 
Paul

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to