stored procedure datetime question.

TomPhillips

Active member
Joined
Feb 24, 2005
Messages
33
Programming Experience
10+
In a stored procedure, if I declare @myDate DateTime
and
set @myDate = '7/4/2005'

How do I determine if @myDate is a Tuesday?

or

How do I find out what DayOfWeek it is?

This is easy in VB.NET but I can't see how to do it in an sp.

In MSSQL, btw.
 
DATEPART v. DATENAME

I used
if DATENAME(weekday, @myDate) = 'Tuesday' then ...

I wonder if
if DATEPART(day, @myDate) = 3 then ...
is more efficient (assuming Tuesday = 3)?
 
Back
Top