Hello,
How can we find out which week or Year we are in now
Is there any function to achieve that ...
Thanks
Visual C# General
Hello,
How can we find out which week or Year we are in now
Is there any function to achieve that ...
Thanks
You can use DateTime.Now. I think you will have to get creative for the week.
Console
.WriteLine(DateTime.Now.Year); Console.WriteLine(DateTime.Now.Day); Console.WriteLine(DateTime.Now.Month);
There is a very useful class that is not used as often as it should be in the System.Globalization namespace - this is not the only one, by the way... the namespace contains numerous other useful classes and they need to be advertized more.
http://msdn2.microsoft.com/en-us/library/system.globalization.calendar.getweekofyear(VS.71).aspx
Calendar.GetWeekOfYear Method