TaiwanCalendar 類別

定義

台灣曆法。the Taiwan calendar.

public ref class TaiwanCalendar : System::Globalization::Calendar
public class TaiwanCalendar : System.Globalization.Calendar
[System.Serializable]
public class TaiwanCalendar : System.Globalization.Calendar
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class TaiwanCalendar : System.Globalization.Calendar
type TaiwanCalendar = class
    inherit Calendar
Public Class TaiwanCalendar
Inherits Calendar
繼承
TaiwanCalendar
屬性

備註

臺灣行事曆的運作方式與西曆完全相同,不同之處在于年份和紀元不同。The Taiwan calendar works exactly like the Gregorian calendar, except that the year and era are different. TaiwanCalendar 類別只會辨識出目前的紀元。The TaiwanCalendar class recognizes only the current era.

注意

如需在 .NET Framework 中使用 TaiwanCalendar 類別和其他行事曆類別的詳細資訊,請參閱使用行事For information about using the TaiwanCalendar class and the other calendar classes in the .NET Framework, see Working with Calendars.

臺灣日曆中的閏年會對應到西曆中的相同閏年。Leap years in the Taiwan calendar correspond to the same leap years in the Gregorian calendar. 西曆中的閏年會定義為一年的年份,其可被四次整除,但可被100整除。A leap year in the Gregorian calendar is defined as a Gregorian year that is evenly divisible by four, except if it is divisible by 100. 不過,400可整除的西曆年份為閏年。However, Gregorian years that are divisible by 400 are leap years. 一般年份有365天,而閏年有366天。A common year has 365 days and a leap year has 366 days.

臺灣行事曆有12個月,每年28到31天:The Taiwan calendar has 12 months with 28 to 31 days each:

GetMonth 值GetMonth value 月份Month 一般年份中的天數Days in common years 閏年中的天數Days in leap years
11 1月(一月)1月 (January) 3131 3131
22 2月(二月)2月 (February) 2828 2929
33 3月(三月)3月 (March) 3131 3131
44 4月(4月)4月 (April) 3030 3030
55 5月(可能)5月 (May) 3131 3131
66 6月(六月)6月 (June) 3030 3030
77 7月(7月)7月 (July) 3131 3131
88 8月(8月)8月 (August) 3131 3131
99 9月(9月)9月 (September) 3030 3030
1010 10月(10月)10月 (October) 3131 3131
1111 11月(11月)11月 (November) 3030 3030
1212 12月(12月)12月 (December) 3131 3131

二月在閏年期間有29天,而在一般年份中有28天。February has 29 days during leap years and 28 during common years.

西元2001年1月1日的日期The date January 1, 2001 C.E. 在西曆中,相當於臺灣日曆中目前紀元90年1月的第一天。in the Gregorian calendar is equivalent to the first day of January in the year 90 of the current era in the Taiwan calendar.

每個 CultureInfo 都支援一組行事曆。Each CultureInfo supports a set of calendars. Calendar 屬性會傳回文化特性的預設行事曆,而 OptionalCalendars 屬性會傳回陣列,其中包含文化特性支援的所有行事曆。The Calendar property returns the default calendar for the culture, and the OptionalCalendars property returns an array containing all the calendars supported by the culture. 若要變更 CultureInfo所使用的行事曆,應用程式應該將 CultureInfo.DateTimeFormatCalendar 屬性設定為新的 CalendarTo change the calendar used by a CultureInfo, the application should set the Calendar property of CultureInfo.DateTimeFormat to a new Calendar.

給呼叫者的注意事項

-如果 CalendarTaiwanCalendar,但 CurrentCulture 不是 "zh-臺灣",則 NativeCalendarNameGetEraName(Int32)GetAbbreviatedEraName(Int32) 會傳回空字串("")。- If Calendar is the TaiwanCalendar but the CurrentCulture is not "zh-TW", then NativeCalendarName, GetEraName(Int32), and GetAbbreviatedEraName(Int32) return an empty string ("").

建構函式

TaiwanCalendar()

初始化 TaiwanCalendar 類別的新執行個體。Initializes a new instance of the TaiwanCalendar class.

欄位

CurrentEra

表示目前曆法的目前紀元。Represents the current era of the current calendar. 此欄位的值為 0。The value of this field is 0.

(繼承來源 Calendar)

屬性

AlgorithmType

取得值,指出目前的月曆是以陽曆為主、以陰曆為主,還是同時包含兩種曆法。Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.

DaysInYearBeforeMinSupportedYear

取得 MinSupportedDateTime 屬性指定之年的前一年的天數。Gets the number of days in the year that precedes the year that is specified by the MinSupportedDateTime property.

(繼承來源 Calendar)
Eras

取得 TaiwanCalendar 中的紀元清單。Gets the list of eras in the TaiwanCalendar.

IsReadOnly

取得值,指出 Calendar 物件是否為唯讀。Gets a value indicating whether this Calendar object is read-only.

(繼承來源 Calendar)
MaxSupportedDateTime

取得 TaiwanCalendar 類別所支援的最晚日期和時間。Gets the latest date and time supported by the TaiwanCalendar class.

MinSupportedDateTime

取得 TaiwanCalendar 類別所支援的最早日期和時間。Gets the earliest date and time supported by the TaiwanCalendar class.

TwoDigitYearMax

取得或設定以二位數年份表示時,該 100 年範圍的最後一年。Gets or sets the last year of a 100-year range that can be represented by a 2-digit year.

方法

AddDays(DateTime, Int32)

傳回與指定 DateTime 相差指定日數的 DateTimeReturns a DateTime that is the specified number of days away from the specified DateTime.

(繼承來源 Calendar)
AddHours(DateTime, Int32)

傳回與指定 DateTime 相差指定時數的 DateTimeReturns a DateTime that is the specified number of hours away from the specified DateTime.

(繼承來源 Calendar)
AddMilliseconds(DateTime, Double)

傳回與指定 DateTime 相差指定毫秒數的 DateTimeReturns a DateTime that is the specified number of milliseconds away from the specified DateTime.

(繼承來源 Calendar)
AddMinutes(DateTime, Int32)

傳回與指定 DateTime 相差指定分鐘數的 DateTimeReturns a DateTime that is the specified number of minutes away from the specified DateTime.

(繼承來源 Calendar)
AddMonths(DateTime, Int32)

傳回與指定 DateTime 相差指定月數的 DateTimeReturns a DateTime that is the specified number of months away from the specified DateTime.

AddSeconds(DateTime, Int32)

傳回與指定 DateTime 相差指定秒數的 DateTimeReturns a DateTime that is the specified number of seconds away from the specified DateTime.

(繼承來源 Calendar)
AddWeeks(DateTime, Int32)

傳回與指定 DateTime 相差指定週數的 DateTimeReturns a DateTime that is the specified number of weeks away from the specified DateTime.

(繼承來源 Calendar)
AddYears(DateTime, Int32)

傳回與指定 DateTime 相差指定年數的 DateTimeReturns a DateTime that is the specified number of years away from the specified DateTime.

Clone()

建立目前 Calendar 物件複本的新物件。Creates a new object that is a copy of the current Calendar object.

(繼承來源 Calendar)
Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetDayOfMonth(DateTime)

傳回指定 DateTime 中月份的日期。Returns the day of the month in the specified DateTime.

GetDayOfWeek(DateTime)

傳回指定 DateTime 中的星期。Returns the day of the week in the specified DateTime.

GetDayOfYear(DateTime)

傳回指定之 DateTime 中一年中的日期。Returns the day of the year in the specified DateTime.

GetDaysInMonth(Int32, Int32)

傳回目前紀元之指定月份和年份中的天數。Returns the number of days in the specified month and year of the current era.

(繼承來源 Calendar)
GetDaysInMonth(Int32, Int32, Int32)

傳回在指定紀元的指定年份的指定月份中的日數。Returns the number of days in the specified month in the specified year in the specified era.

GetDaysInYear(Int32)

傳回目前紀元之指定年份中的天數。Returns the number of days in the specified year of the current era.

(繼承來源 Calendar)
GetDaysInYear(Int32, Int32)

傳回在指定紀元的指定年份中的日數。Returns the number of days in the specified year in the specified era.

GetEra(DateTime)

傳回指定 DateTime 中的紀元。Returns the era in the specified DateTime.

GetHashCode()

作為預設雜湊函數。Serves as the default hash function.

(繼承來源 Object)
GetHour(DateTime)

傳回指定 DateTime 中的小時值。Returns the hours value in the specified DateTime.

(繼承來源 Calendar)
GetLeapMonth(Int32)

計算指定年份的閏月。Calculates the leap month for a specified year.

(繼承來源 Calendar)
GetLeapMonth(Int32, Int32)

計算指定年份和紀元的閏月。Calculates the leap month for a specified year and era.

GetMilliseconds(DateTime)

傳回指定 DateTime 中的毫秒值。Returns the milliseconds value in the specified DateTime.

(繼承來源 Calendar)
GetMinute(DateTime)

傳回指定 DateTime 中的分鐘值。Returns the minutes value in the specified DateTime.

(繼承來源 Calendar)
GetMonth(DateTime)

傳回指定 DateTime 中的月份。Returns the month in the specified DateTime.

GetMonthsInYear(Int32)

傳回目前紀元的指定年份中的月數。Returns the number of months in the specified year in the current era.

(繼承來源 Calendar)
GetMonthsInYear(Int32, Int32)

傳回在指定紀元的指定年份中的月數。Returns the number of months in the specified year in the specified era.

GetSecond(DateTime)

傳回指定 DateTime 中的秒值。Returns the seconds value in the specified DateTime.

(繼承來源 Calendar)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
GetWeekOfYear(DateTime, CalendarWeekRule, DayOfWeek)

傳回年份中的週,包含指定 DateTime 中的日期。Returns the week of the year that includes the date in the specified DateTime.

GetYear(DateTime)

傳回指定 DateTime 中的年份。Returns the year in the specified DateTime.

IsLeapDay(Int32, Int32, Int32)

判斷目前紀元中指定日期是否為閏日。Determines whether the specified date in the current era is a leap day.

(繼承來源 Calendar)
IsLeapDay(Int32, Int32, Int32, Int32)

判斷指定紀元中指定的日期是否為閏日。Determines whether the specified date in the specified era is a leap day.

IsLeapMonth(Int32, Int32)

判斷目前紀元的指定年份中指定的月份是否為閏月。Determines whether the specified month in the specified year in the current era is a leap month.

(繼承來源 Calendar)
IsLeapMonth(Int32, Int32, Int32)

判斷指定紀元的指定年份中指定的月份是否為閏月。Determines whether the specified month in the specified year in the specified era is a leap month.

IsLeapYear(Int32)

判斷目前紀元中指定的年份是否為閏年。Determines whether the specified year in the current era is a leap year.

(繼承來源 Calendar)
IsLeapYear(Int32, Int32)

判斷指定紀元中指定的年份是否為閏年。Determines whether the specified year in the specified era is a leap year.

MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
ToDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32)

傳回設定為目前紀元中指定日期和時間的 DateTimeReturns a DateTime that is set to the specified date and time in the current era.

(繼承來源 Calendar)
ToDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32)

傳回在指定紀元中設定為指定日期和時間的 DateTimeReturns a DateTime that is set to the specified date and time in the specified era.

ToFourDigitYear(Int32)

將指定的年份轉換為 4 位數年份,方法是使用 TwoDigitYearMax 屬性以判斷適當的世紀。Converts the specified year to a four-digit year by using the TwoDigitYearMax property to determine the appropriate century.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

適用於

另請參閱