SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Development Tools
 ASP.NET
 WeekDay as Number
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kris55
Starting Member

6 Posts

Posted - 04/18/2007 :  19:28:46  Show Profile  Reply with Quote

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 me

I have a date field suppose 4/18/2007. I want to get the Number from this date

Lets say

Monday - 1
Tuesday - 2
Wednesday -3
Thursday - 4
Friday - 5
Saturday - 6
Sunday - 7



the above date is Wednesday so i want to get the number "3"

Is it possible..? appreciate your help guys
I am using VB.NET/ASP.NET
Thanks
Kris

khtan
In (Som, Ni, Yak)

Singapore
17595 Posts

Posted - 04/18/2007 :  19:43:02  Show Profile  Reply with Quote

select datepart(weekday, '20070418')



KH

Go to Top of Page

cvraghu
Posting Yak Master

India
187 Posts

Posted - 04/18/2007 :  19:46:54  Show Profile  Reply with Quote
Please read the help for DateTime.DayOfWeek in MSDN.

DateTime dt = new DateTime(2003, 5, 1);
Console.WriteLine(dt.DayOfWeek);
Go to Top of Page

jezemine
Flowing Fount of Yak Knowledge

USA
2886 Posts

Posted - 04/19/2007 :  00:30:04  Show Profile  Visit jezemine's Homepage  Reply with Quote
note that datepart is 1-based but DateTime.DayOfWeek is 0-based.

1-based enums/collections are so annoying!!


www.elsasoft.org
Go to Top of Page

kris55
Starting Member

6 Posts

Posted - 04/19/2007 :  12:10:22  Show Profile  Reply with Quote
quote:
Originally posted by khtan


select datepart(weekday, '20070418')



KH





Thx guys appreciate your help
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000