In SQL Server 2008, given a date, how would I get a date corresponding to FRI of that week?
so for example:
6/6/2012 -> 6/8/2012
6/5/2012 -> 6/8/2012
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming you want 6/9/2012 to also return 6/8/2012 (same week), this would work.
It get’s the day of week of the current date and adds the difference between that and Friday which is hardcoded to a value of 6.
If you want 6/9/2012 to return the next Friday, you just have to make a small modification: