C# - Weekly 숫자 가져오기

seung-jae hwang·2019년 4월 11일
0

C샵

목록 보기
6/17
        // Gets the Calendar instance associated with a CultureInfo.
        //CultureInfo myCI = new CultureInfo("en-US");
        CultureInfo myCI = new CultureInfo("ko-KR");
        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, 4, 11);
        Console.WriteLine("There are {0} weeks in the current year ({1}).", myCal.GetWeekOfYear(LastDay, myCWR, myFirstDOW), LastDay.Year);

0개의 댓글