本文整理汇总了C#中System.Globalization.KoreanCalendar.GetWeekOfYear方法的典型用法代码示例。如果您正苦于以下问题:C# KoreanCalendar.GetWeekOfYear方法的具体用法?C# KoreanCalendar.GetWeekOfYear怎么用?C# KoreanCalendar.GetWeekOfYear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。
在下文中一共展示了KoreanCalendar.GetWeekOfYear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Main
//引入命名空间
using System;
using System.Globalization;
public class SamplesCalendar {
public static void Main() {
// Gets the Calendar instance associated with a CultureInfo.
CultureInfo myCI = new CultureInfo("en-US");
Calendar myCal = myCI.Calendar;
// Gets the DTFI properties required by GetWeekOfYear.
CalendarWeekRule myCWR = myCI.DateTimeFormat.CalendarWeekRule;
DayOfWeek myFirstDOW = myCI.DateTimeFormat.FirstDayOfWeek;
// Displays the number of the current week relative to the beginning of the year.
Console.WriteLine( "The CalendarWeekRule used for the en-US culture is {0}.", myCWR );
Console.WriteLine( "The FirstDayOfWeek used for the en-US culture is {0}.", myFirstDOW );
Console.WriteLine( "Therefore, the current week is Week {0} of the current year.", myCal.GetWeekOfYear( DateTime.Now, myCWR, myFirstDOW ));
// Displays the total number of weeks in the current year.
DateTime LastDay = new System.DateTime( DateTime.Now.Year, 12, 31 );
Console.WriteLine( "There are {0} weeks in the current year ({1}).", myCal.GetWeekOfYear( LastDay, myCWR, myFirstDOW ), LastDay.Year );
}
}
/*
This code produces the following output. Results vary depending on the system date.
The CalendarWeekRule used for the en-US culture is FirstDay.
The FirstDayOfWeek used for the en-US culture is Sunday.
Therefore, the current week is Week 1 of the current year.
There are 53 weeks in the current year (2001).
*/
开发者ID:.NET开发者,项目名称:System.Globalization,代码行数:36,代码来源:KoreanCalendar.GetWeekOfYear
注:本文中的System.Globalization.KoreanCalendar.GetWeekOfYear方法示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论