一年中的周数? [英] Number of weeks in year?

查看:135
本文介绍了一年中的周数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨。


.NET中是否有一种采用年的方法。作为一个论点,并返回该年的总周数?对于文化da-DK(丹麦语)。


提前致谢。


Tommy。

Hi.

Is there a method in .NET that takes "year" as an argument and returns the total
number of weeks in that year? For culture da-DK (Danish).

Thanks in advance.

Tommy.

推荐答案

" Tommy Jakobsen" < to *** @ holmjakobsen.dkwrote in message

news:1m *************************** ***** @ 4ax.com ...
"Tommy Jakobsen" <to***@holmjakobsen.dkwrote in message
news:1m********************************@4ax.com...

嗨。


.NET中是否有方法可以需要年作为一个论点,并在那一年返回

总额

的周数?对于文化da-DK(丹麦语)。
Hi.

Is there a method in .NET that takes "year" as an argument and returns the
total
number of weeks in that year? For culture da-DK (Danish).



浮动w =(DateTime.IsLeapYear(年)?366:365)/ 7


或者您是否按照特定日期的出现来衡量周数?

当周被视为一周的开始?

-

Anthony Jones - MVP ASP / ASP.NET

float w = (DateTime.IsLeapYear(year) ? 366 : 365) / 7

Or are do you measure the count of weeks by the appearance of a specific day
of the week considered to be the start of a week in that year?

--
Anthony Jones - MVP ASP/ASP.NET


丹麦语有什么特别之处日历?即答案不是

总是52? (加上几天)


Tommy Jakobsen < to *** @ holmjakobsen.dkwrote in message

news:1m *************************** ***** @ 4ax.com ...
Is there something special about the Danish calendar? i.e. is the answer not
always 52? (plus a couple of days)

"Tommy Jakobsen" <to***@holmjakobsen.dkwrote in message
news:1m********************************@4ax.com...

嗨。


.NET中是否有方法可以需要年作为一个论点,并在那一年返回

总额

的周数?对于文化da-DK(丹麦语)。


提前致谢。


Tommy。
Hi.

Is there a method in .NET that takes "year" as an argument and returns the
total
number of weeks in that year? For culture da-DK (Danish).

Thanks in advance.

Tommy.




" Clint"写道:

"Clint" wrote:

丹麦日历有什么特别之处吗?即答案不是

总是52? (加上几天)


Tommy Jakobsen < to *** @ holmjakobsen.dkwrote in message

news:1m *************************** ***** @ 4ax.com ...
Is there something special about the Danish calendar? i.e. is the answer not
always 52? (plus a couple of days)

"Tommy Jakobsen" <to***@holmjakobsen.dkwrote in message
news:1m********************************@4ax.com...

嗨。


.NET中是否有方法可以需要年作为一个论点,并在那一年返回

总额

的周数?对于文化da-DK(丹麦语)。


提前致谢。


Tommy。
Hi.

Is there a method in .NET that takes "year" as an argument and returns the
total
number of weeks in that year? For culture da-DK (Danish).

Thanks in advance.

Tommy.



有时一年有53周。


int year = 2004;

DateTime dt = new DateTime(年,12,31);

int week = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(

dt,

CalendarWeekRule.FirstFourDayWeek,

DayOfWeek.Monday);

//周== 53


- < br $>
快乐编码!

Morten Wennevik [C#MVP]

Sometimes there are 53 weeks in a year.

int year = 2004;
DateTime dt = new DateTime(year, 12, 31);
int week = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(
dt,
CalendarWeekRule.FirstFourDayWeek,
DayOfWeek.Monday);
// week == 53

--
Happy Coding!
Morten Wennevik [C# MVP]


这篇关于一年中的周数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆