By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,180 Members | 1,016 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,180 IT Pros & Developers. It's quick & easy.

Week support in date classes

P: n/a
JH
Why there is not full week support in DateTime classes
in .NET. For instance windows`s normal calendar control
knows how to show week numbers, but you can`t ask that
from DateTime class.

Also here in Finland first week in year can be week 52,
week 53 or week 1. Also last week of the year can be any
of those. So there can be two "week 1"`s in same year
(they can be distinquished by using month number).

DateTime dtDate = DateTime::CurrentDate;
int iWeek = dtDate.WeekNumber
Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
JH <jh@discussions.microsoft.com> wrote:
Why there is not full week support in DateTime classes
in .NET. For instance windows`s normal calendar control
knows how to show week numbers, but you can`t ask that
from DateTime class.

Also here in Finland first week in year can be week 52,
week 53 or week 1. Also last week of the year can be any
of those. So there can be two "week 1"`s in same year
(they can be distinquished by using month number).

DateTime dtDate = DateTime::CurrentDate;
int iWeek = dtDate.WeekNumber


Look at Calendar.GetWeekOfYear, which addresses both of these issues.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.