To know what day of the week is on a datetime value you can find it in two easy ways:
Method # 1
SELECT DATEPART(weekday,[date_var])
it will return:
1 for Sunday
2 for Monday
3 for Tueday
4 for Wednesday
5 for Thursday
6 for Friday
7 for Saturday
For example:
SELECT DATEPART(weekday,'2010-8-2')
Result:
2
Method # 2
SELECT DATENAME(dw, GETDATE())
It will return the name of the current day
Result:
Monday
0 comentarios:
Publicar un comentario