.NET Framework 類別庫
TaiwanCalendar 類別

表示台灣使用的曆法。

命名空間: System.Globalization
組件: mscorlib (在 mscorlib.dll 中)

語法

Visual Basic (宣告)
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Class TaiwanCalendar
    Inherits Calendar
Visual Basic (使用方式)
Dim instance As TaiwanCalendar
C#
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public class TaiwanCalendar : Calendar
C++
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public ref class TaiwanCalendar : public Calendar
J#
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public class TaiwanCalendar extends Calendar
JScript
SerializableAttribute 
ComVisibleAttribute(true) 
public class TaiwanCalendar extends Calendar
備註

台灣曆法運作方式與西曆完全一樣,只是年份和紀元不同。TaiwanCalendar 類別只識別目前的紀元。

台灣曆法中的閏年與西曆中的閏年相符。在西曆中,閏年被定義為能被 4 整除而不被 100 整除的年份,但是能被 400 整除。平年有 365 天,而閏年有 366 天。

台灣使用的曆法有 12 月份,各有 28 至 31 天:

GetMonth 值

月份

平年的天數

閏年的天數

1

1 月 (一月)

31

31

2

2 月 (二月)

28

29

3

3 月 (三月)

31

31

4

4 月 (四月)

30

30

5

5 月 (五月)

31

31

6

6 月 (六月)

30

30

7

7 月 (七月)

31

31

8

8 月 (八月)

31

31

9

9 月 (九月)

30

30

10

10 月 (十月)

31

31

11

11 月 (十一月)

30

30

12

12 月 (十二月)

31

31

在閏年,二月份有 29 天,而在平年則有 28 天。

西曆中的日期 C.E. 紀元 2001 年一月 1 日等於台灣使用的曆法目前紀元的 90 年一月的第一天。

每一 CultureInfo 都支援一套曆法。Calendar 屬性傳回預設文化特性 (Culture) 的曆法,而 OptionalCalendars 屬性則傳回陣列,其包含文化特性所支援的所有曆法。若要變更 CultureInfo 所使用的曆法,請將 CultureInfo.DateTimeFormatCalendar 屬性設定為新的 Calendar

呼叫者注意事項

繼承階層架構

System.Object
   System.Globalization.Calendar
    System.Globalization.TaiwanCalendar
執行緒安全

這個型別的所有公用靜態成員 (即 Visual Basic 中的 Shared 成員) 都是安全執行緒。並非所有的執行個體成員均為安全執行緒。
平台

Windows 98、 Windows 2000 SP4、 Windows CE、 Windows Millennium Edition、 Windows Mobile for Pocket PC、 Windows Mobile for Smartphone、 Windows Server 2003、 Windows XP Media Center Edition、 Windows XP Professional x64 Edition、 Windows XP SP2、 Windows XP Starter Edition

.NET Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱系統需求一節的內容。

版本資訊

.NET Framework

支援版本:2.0、1.1、1.0

.NET Compact Framework

支援版本:2.0、1.0
請參閱

標記 :


Page view tracker