Click here to Skip to main content
16,012,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

How to get weekno.s based on the particular date?
Posted
Comments
R. Giskard Reventlov 22-Jul-11 4:32am    
What have you already tried?

Check out MSDN
http://msdn.microsoft.com/en-us/library/system.globalization.calendar.getweekofyear.aspx
 
Share this answer
 
try this :

C#
public static int GetWeekNumber(DateTime dtPassed)
{
        CultureInfo ciCurr = CultureInfo.CurrentCulture;
        int weekNum = ciCurr.Calendar.GetWeekOfYear(dtPassed, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
        return weekNum;
}


hope it helps :)
 
Share this answer
 
Comments
shefeekcm 22-Jul-11 6:49am    
correct answer......my 5.
Uday P.Singh 22-Jul-11 7:17am    
but you voted one my dear :(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900