1

In SQL Server I am calculating a date based on certain business rules. If the date falls on a weekend I need to move it up to the next monday...so basically:

if(date == saturday)
{
 add 2 days
}
if(date == sunday)
{
  add 2 day
}

What is the easiest way to accomplish this?

stephen776
  • 9,134
  • 15
  • 74
  • 123

2 Answers2

3

Extract it from DateTime.

http://msdn.microsoft.com/en-us/library/bb762911.aspx

Paul

1

Use DATENAME as per MSDN.

Example: select datename(weekday, getdate()) returns Thursday as of today.

vonPryz
  • 22,996
  • 7
  • 54
  • 65