本文整理匯總了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;
}
示例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));
}
示例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;
}