當前位置: 首頁>>代碼示例>>C#>>正文


C# PersianCalendar.GetDayOfWeek方法代碼示例

本文整理匯總了C#中System.Globalization.PersianCalendar.GetDayOfWeek方法的典型用法代碼示例。如果您正苦於以下問題:C# PersianCalendar.GetDayOfWeek方法的具體用法?C# PersianCalendar.GetDayOfWeek怎麽用?C# PersianCalendar.GetDayOfWeek使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Globalization.PersianCalendar的用法示例。


在下文中一共展示了PersianCalendar.GetDayOfWeek方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ToLongPersianDateStringPersianDigit

        public string ToLongPersianDateStringPersianDigit(DateTime? date)
        {
            if (date == null)
                return string.Empty;

            var calendar = new PersianCalendar();

            var day = calendar.GetDayOfMonth(date.Value);
            var dayOfWeek = calendar.GetDayOfWeek(date.Value);
            var month = calendar.GetMonth(date.Value);
            var year = calendar.GetYear(date.Value);

            var persianString = string.Format("{0} {1} {2} {3}", GetPersianNameOfWeek(dayOfWeek),
                                              FConvert.ToPersianDigit(day), GetPersianNameOfMonth(month),
                                              FConvert.ToPersianDigit(year));

            return persianString;
        }
開發者ID:arabsoheyl,項目名稱:fardis,代碼行數:18,代碼來源:DateTimeHelper.cs

示例2: PersianDat

 public string PersianDat(DateTime Mdate)
 {
     PersianCalendar ps = new PersianCalendar();
     return string.Format(" {2}/{1}/{0}", ps.GetDayOfMonth(Mdate),
     ps.GetMonth(Mdate), ps.GetYear(Mdate), ps.GetDayOfWeek(Mdate));
 }
開發者ID:rad-navid,項目名稱:forms-automation,代碼行數:6,代碼來源:FrmEghdamPaghohi.cs

示例3: ShowDate

        private void ShowDate()
        {
            PersianCalendar p = new PersianCalendar();
            int year = p.GetYear(DateTime.Now);
            int month = p.GetMonth(DateTime.Now);
            int day = p.GetDayOfMonth(DateTime.Now);

            string str = "امروز ";
            DayOfWeek d = p.GetDayOfWeek(DateTime.Now);
            switch (d)
            {
                case DayOfWeek.Friday: { str += " جمعه "; break; }
                case DayOfWeek.Monday: { str += " دوشنبه "; break; }
                case DayOfWeek.Saturday: { str += " شنبه "; break; }
                case DayOfWeek.Sunday: { str += " یکشنبه "; break; }
                case DayOfWeek.Thursday: { str += " پنجشنبه "; break; }
                case DayOfWeek.Tuesday: { str += " سه شنبه "; break; }
                case DayOfWeek.Wednesday: { str += " چهارشنبه "; break; }
            }
            str += day + " ";
            string[] ListMonth = { "فروردین ماه", "اردیبهشت ماه", " خردادماه ", " تیرماه ", " مردادماه ", " شهریورماه ", " مهرماه ", " آبان ماه ", " آذرماه ", " دی ماه ", " بهمن ماه ", " اسفندماه " };
            str += ListMonth[month - 1];
            str += " سال " + year;
            DateLable.Text = str;
        }
開發者ID:NavidDorfeshan,項目名稱:WinFormapp_EsfahanGhos,代碼行數:25,代碼來源:Form_MainMenu.cs


注:本文中的System.Globalization.PersianCalendar.GetDayOfWeek方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。