Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
kris55
Starting Member
6 Posts |
Posted - 2007-04-18 : 19:28:46
|
Hello Folks,I am new to this forum and very excited to see this. I have a question in asp.net can any body help meI have a date field suppose 4/18/2007. I want to get the Number from this date Lets sayMonday - 1Tuesday - 2Wednesday -3Thursday - 4Friday - 5Saturday - 6Sunday - 7the above date is Wednesday so i want to get the number "3"Is it possible..? appreciate your help guysI am using VB.NET/ASP.NETThanksKris |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-04-18 : 19:43:02
|
[code]select datepart(weekday, '20070418')[/code] KH |
|
|
cvraghu
Posting Yak Master
187 Posts |
Posted - 2007-04-18 : 19:46:54
|
Please read the help for DateTime.DayOfWeek in MSDN. DateTime dt = new DateTime(2003, 5, 1);Console.WriteLine(dt.DayOfWeek); |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2007-04-19 : 00:30:04
|
note that datepart is 1-based but DateTime.DayOfWeek is 0-based. 1-based enums/collections are so annoying!! www.elsasoft.org |
|
|
kris55
Starting Member
6 Posts |
Posted - 2007-04-19 : 12:10:22
|
quote: Originally posted by khtan
select datepart(weekday, '20070418') KH
Thx guys appreciate your help |
|
|
|
|
|