DateTimeFormatInfo.GetDayName(DayOfWeek) 方法

定義

根據與目前 DateTimeFormatInfo 物件關聯的文化特性,傳回一星期內指定某一天的文化特性特有完整名稱。Returns the culture-specific full name of the specified day of the week based on the culture associated with the current DateTimeFormatInfo object.

public:
 System::String ^ GetDayName(DayOfWeek dayofweek);
public string GetDayName (DayOfWeek dayofweek);
member this.GetDayName : DayOfWeek -> string

參數

dayofweek
DayOfWeek

DayOfWeek 值。A DayOfWeek value.

傳回

dayofweek 所表示星期的特定文化特性之完整名稱。The culture-specific full name of the day of the week represented by dayofweek.

例外狀況

dayofweek 不是有效的 DayOfWeek 值。dayofweek is not a valid DayOfWeek value.

備註

若為預設的DateTimeFormatInfo不變物件,這個方法會GregorianCalendar從物件傳回字串。For the default invariant DateTimeFormatInfo object, this method returns a string from the GregorianCalendar object.

dayofweek 傳回值Return Value
星期日Sunday 星期天"Sunday"
週一Monday 下周"Monday"
星期二Tuesday 星期二"Tuesday"
週三Wednesday 星期三"Wednesday"
星期四Thursday 星期四"Thursday"
週五Friday 為止"Friday"
星期六Saturday 週六"Saturday"

適用於

另請參閱