GregorianCalendar GregorianCalendar GregorianCalendar GregorianCalendar Class

定義

代表西曆。Represents the Gregorian calendar.

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

範例

下列程式碼範例顯示DateTimeFormatInfo月曆是西曆和文化特性使用紀元名稱"西元 」 時,才會忽略在紀元名稱中,標點符號。The following code example shows that DateTimeFormatInfo ignores the punctuation in the era name, only if the calendar is Gregorian and the culture uses the era name "A.D.".

using namespace System;
using namespace System::Globalization;
using namespace System::Collections;
int main()
{
   
   // Creates strings with punctuation and without.
   String^ strADPunc = "A.D.";
   String^ strADNoPunc = "AD";
   String^ strCEPunc = "C.E.";
   String^ strCENoPunc = "CE";
   
   // Calls DTFI::GetEra for each culture that uses GregorianCalendar as the default calendar.
   Console::WriteLine( "            ----- AD -----  ----- CE -----" );
   Console::WriteLine( "CULTURE     PUNC   NO PUNC  PUNC   NO PUNC  CALENDAR" );
   IEnumerator^ en = CultureInfo::GetCultures( CultureTypes::SpecificCultures )->GetEnumerator();
   while ( en->MoveNext() )
   {
      CultureInfo^ myCI = safe_cast<CultureInfo^>(en->Current);
      Console::Write( "{0, -12}", myCI );
      Console::Write( "{0,-7}{1,-9}", myCI->DateTimeFormat->GetEra( strADPunc ), myCI->DateTimeFormat->GetEra( strADNoPunc ) );
      Console::Write( "{0, -7}{1, -9}", myCI->DateTimeFormat->GetEra( strCEPunc ), myCI->DateTimeFormat->GetEra( strCENoPunc ) );
      Console::Write( "{0}", myCI->Calendar );
      Console::WriteLine();
   }
}

/*
This code produces the following output.  This output has been cropped for brevity.

            ----- AD -----  ----- CE -----
CULTURE     PUNC   NO PUNC  PUNC   NO PUNC  CALENDAR
ar-SA       -1     -1       -1     -1       System.Globalization.HijriCalendar
ar-IQ       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-EG       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-LY       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-DZ       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-MA       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-TN       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-OM       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-YE       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-SY       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-JO       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-LB       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-KW       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-AE       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-BH       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-QA       1      1        -1     -1       System.Globalization.GregorianCalendar
bg-BG       1      1        -1     -1       System.Globalization.GregorianCalendar
ca-ES       -1     -1       -1     -1       System.Globalization.GregorianCalendar
zh-TW       -1     -1       -1     -1       System.Globalization.GregorianCalendar
zh-CN       -1     -1       -1     -1       System.Globalization.GregorianCalendar
zh-HK       1      1        -1     -1       System.Globalization.GregorianCalendar
zh-SG       1      1        -1     -1       System.Globalization.GregorianCalendar
zh-MO       1      1        -1     -1       System.Globalization.GregorianCalendar
cs-CZ       -1     -1       -1     -1       System.Globalization.GregorianCalendar
da-DK       1      1        -1     -1       System.Globalization.GregorianCalendar

*/
using System;
using System.Globalization;


public class SamplesGregorianCalendar  {

   public static void Main()  {

      // Creates strings with punctuation and without.
      String strADPunc = "A.D.";
      String strADNoPunc = "AD";
      String strCEPunc = "C.E.";
      String strCENoPunc = "CE";

      // Calls DTFI.GetEra for each culture that uses GregorianCalendar as the default calendar.
      Console.WriteLine( "            ----- AD -----  ----- CE -----" );
      Console.WriteLine( "CULTURE     PUNC   NO PUNC  PUNC   NO PUNC  CALENDAR" );
      foreach ( CultureInfo myCI in CultureInfo.GetCultures( CultureTypes.SpecificCultures ) )  {
         Console.Write( "{0,-12}", myCI );
         Console.Write( "{0,-7}{1,-9}", myCI.DateTimeFormat.GetEra( strADPunc ), myCI.DateTimeFormat.GetEra( strADNoPunc ) );
         Console.Write( "{0,-7}{1,-9}", myCI.DateTimeFormat.GetEra( strCEPunc ), myCI.DateTimeFormat.GetEra( strCENoPunc ) );
         Console.Write( "{0}", myCI.Calendar );
         Console.WriteLine();
      }

   }

}

/*
This code produces the following output.  This output has been cropped for brevity.

            ----- AD -----  ----- CE -----
CULTURE     PUNC   NO PUNC  PUNC   NO PUNC  CALENDAR
ar-SA       -1     -1       -1     -1       System.Globalization.HijriCalendar
ar-IQ       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-EG       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-LY       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-DZ       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-MA       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-TN       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-OM       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-YE       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-SY       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-JO       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-LB       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-KW       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-AE       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-BH       1      1        -1     -1       System.Globalization.GregorianCalendar
ar-QA       1      1        -1     -1       System.Globalization.GregorianCalendar
bg-BG       1      1        -1     -1       System.Globalization.GregorianCalendar
ca-ES       -1     -1       -1     -1       System.Globalization.GregorianCalendar
zh-TW       -1     -1       -1     -1       System.Globalization.GregorianCalendar
zh-CN       -1     -1       -1     -1       System.Globalization.GregorianCalendar
zh-HK       -1     -1       -1     -1       System.Globalization.GregorianCalendar
zh-SG       1      1        -1     -1       System.Globalization.GregorianCalendar
zh-MO       1      1        -1     -1       System.Globalization.GregorianCalendar
cs-CZ       -1     -1       -1     -1       System.Globalization.GregorianCalendar
da-DK       1      1        -1     -1       System.Globalization.GregorianCalendar

*/
Imports System
Imports System.Globalization

Public Class SamplesGregorianCalendar

   Public Shared Sub Main()

      ' Creates strings with punctuation and without.
      Dim strADPunc As [String] = "A.D."
      Dim strADNoPunc As [String] = "AD"
      Dim strCEPunc As [String] = "C.E."
      Dim strCENoPunc As [String] = "CE"

      ' Calls DTFI.GetEra for each culture that uses GregorianCalendar as the default calendar.
      Console.WriteLine("            ----- AD -----  ----- CE -----")
      Console.WriteLine("CULTURE     PUNC   NO PUNC  PUNC   NO PUNC  CALENDAR")
      Dim myCI As CultureInfo
      For Each myCI In  CultureInfo.GetCultures(CultureTypes.SpecificCultures)
         Console.Write("{0,-12}", myCI)
         Console.Write("{0,-7}{1,-9}", myCI.DateTimeFormat.GetEra(strADPunc), myCI.DateTimeFormat.GetEra(strADNoPunc))
         Console.Write("{0,-7}{1,-9}", myCI.DateTimeFormat.GetEra(strCEPunc), myCI.DateTimeFormat.GetEra(strCENoPunc))
         Console.Write("{0}", myCI.Calendar)
         Console.WriteLine()
      Next myCI

   End Sub 'Main 

End Class 'SamplesGregorianCalendar


'This code produces the following output.  This output has been cropped for brevity.
'
'            ----- AD -----  ----- CE -----
'CULTURE     PUNC   NO PUNC  PUNC   NO PUNC  CALENDAR
'ar-SA       -1     -1       -1     -1       System.Globalization.HijriCalendar
'ar-IQ       1      1        -1     -1       System.Globalization.GregorianCalendar
'ar-EG       1      1        -1     -1       System.Globalization.GregorianCalendar
'ar-LY       1      1        -1     -1       System.Globalization.GregorianCalendar
'ar-DZ       1      1        -1     -1       System.Globalization.GregorianCalendar
'ar-MA       1      1        -1     -1       System.Globalization.GregorianCalendar
'ar-TN       1      1        -1     -1       System.Globalization.GregorianCalendar
'ar-OM       1      1        -1     -1       System.Globalization.GregorianCalendar
'ar-YE       1      1        -1     -1       System.Globalization.GregorianCalendar
'ar-SY       1      1        -1     -1       System.Globalization.GregorianCalendar
'ar-JO       1      1        -1     -1       System.Globalization.GregorianCalendar
'ar-LB       1      1        -1     -1       System.Globalization.GregorianCalendar
'ar-KW       1      1        -1     -1       System.Globalization.GregorianCalendar
'ar-AE       1      1        -1     -1       System.Globalization.GregorianCalendar
'ar-BH       1      1        -1     -1       System.Globalization.GregorianCalendar
'ar-QA       1      1        -1     -1       System.Globalization.GregorianCalendar
'bg-BG       1      1        -1     -1       System.Globalization.GregorianCalendar
'ca-ES       -1     -1       -1     -1       System.Globalization.GregorianCalendar
'zh-TW       -1     -1       -1     -1       System.Globalization.GregorianCalendar
'zh-CN       -1     -1       -1     -1       System.Globalization.GregorianCalendar
'zh-HK       -1     -1       -1     -1       System.Globalization.GregorianCalendar
'zh-SG       1      1        -1     -1       System.Globalization.GregorianCalendar
'zh-MO       1      1        -1     -1       System.Globalization.GregorianCalendar
'cs-CZ       -1     -1       -1     -1       System.Globalization.GregorianCalendar
'da-DK       1      1        -1     -1       System.Globalization.GregorianCalendar

備註

西曆會辨識兩個紀元: 西元前The Gregorian calendar recognizes two eras: B.C. 或年和 A.D.or B.C.E., and A.D. 或西元or C.E. 這個實作GregorianCalendar類別能夠辨識只有在目前紀元 (A.D.This implementation of the GregorianCalendar class recognizes only the current era (A.D. 或 C.E.)。or C.E.).

注意

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

閏年西曆中被定義為年份為整除 4,除非它是以 100 整除。A leap year in the Gregorian calendar is defined as a year that is evenly divisible by 4, unless it is divisible by 100. 不過,由 400 整除的年份是閏年。However, years that are divisible by 400 are leap years. 比方說,1900 年不是閏年,但 2000 年。For example, the year 1900 was not a leap year, but the year 2000 was. 一般年份有 365 天,閏年有 366 天。A common year has 365 days and a leap year has 366 days.

西曆具有各有 28 至 31 天的 12 個月: 年 1 月 (31 天)、 2 月 (28 或 29 天)、 3 月 (31 天)、 4 月 (30 天)、 月 (31 天),年 6 月 (30 天) 」、 「 年 7 月 (31 天) 」、 「 年 8 月 (31 天) 」、 「 年 9 月 (30 天)、 「 年 10 月 (31 天),年 11 月 (30 天)與年 12 月 (31 天)。The Gregorian calendar has 12 months with 28 to 31 days each: January (31 days), February (28 or 29 days), March (31 days), April (30 days), May (31 days), June (30 days), July (31 days), August (31 days), September (30 days), October (31 days), November (30 days), and December (31 days). 二月有 29 天,閏年和 28。February has 29 days during leap years and 28 during common years.

重要

根據預設,所有DateTimeDateTimeOffset值 express 中的西曆日期和時間。By default, all DateTime and DateTimeOffset values express dates and times in the Gregorian calendar.

西曆已開發為凱撒曆法的取代項目 (代表JulianCalendar類別) 首度引進的一小部分的文化特性,1582 年 10 月 15 號上。The Gregorian calendar was developed as a replacement for the Julian calendar (which is represented by the JulianCalendar class) and was first introduced in a small number of cultures on October 15, 1582. 使用歷程記錄的日期之前的西曆的文化特性的採用,您應該使用原始的行事曆,如果它是.NET Framework 中可用。When working with historic dates that precede a culture's adoption of the Gregorian calendar, you should use the original calendar if it is available in the .NET Framework. 比方說,丹麥從變更凱撒曆法為西曆年 2 月 19 (在凱撒曆法) 或年 3 月 (以西曆) 的 1 為 1700年。For example, Denmark changed from the Julian calendar to the Gregorian calendar on February 19 (in the Julian calendar) or March 1 (in the Gregorian calendar) of 1700. 在此案例中,日期早於西曆的採用,您應該使用凱撒曆法。In this case, for dates before the adoption of the Gregorian calendar, you should use the Julian calendar. 不過,請注意,任何文化特性會提供內建支援JulianCalendar類別。However, note that no culture offers intrinsic support for the JulianCalendar class. 您必須使用JulianCalendar類別做為獨立曆法。You must use the JulianCalendar class as a standalone calendar. 如需詳細資訊,請參閱 < 使用行事曆For more information, see Working with calendars.

下列範例說明為 1700 年 2 月 18,到凱撒曆法,也就是在丹麥正式使用凱撒曆法的最後一天,是早於 1700 年 3 月 1,西曆中的一天。The following example illustrates that February 18, 1700 in the Julian calendar, which is the last day the Julian calendar was officially used in Denmark, is one day earlier than March 1, 1700 in the Gregorian calendar.

using System;
using System.Globalization;
using System.Threading;

public class Example
{
   public static void Main()
   {
      Thread.CurrentThread.CurrentCulture = new CultureInfo("da-DK");
      
      JulianCalendar jc = new JulianCalendar();
      DateTime lastDate = new DateTime(1700, 2, 18, jc);
      Console.WriteLine("Last date (Gregorian): {0:d}", lastDate);
      Console.WriteLine("Last date (Julian): {0}-{1}-{2}\n", jc.GetDayOfMonth(lastDate),
                        jc.GetMonth(lastDate), jc.GetYear(lastDate));
      
      DateTime firstDate = lastDate.AddDays(1);
      Console.WriteLine("First date (Gregorian): {0:d}", firstDate);
      Console.WriteLine("First date (Julian): {0}-{1}-{2}",  jc.GetDayOfMonth(firstDate),
                        jc.GetMonth(firstDate), jc.GetYear(firstDate));
   }
}
// The example displays the following output:
//       Last date (Gregorian): 28-02-1700
//       Last date (Julian): 18-2-1700
//       
//       First date (Gregorian): 01-03-1700
//       First date (Julian): 19-2-1700
Imports System.Globalization
Imports System.Threading

Module Example
   Public Sub Main()
      Thread.CurrentThread.CurrentCulture = New CultureInfo("da-DK")
      
      Dim jc As New JulianCalendar()
      Dim lastDate As New DateTime(1700, 2, 18, jc)
      Console.WriteLine("Last date (Gregorian): {0:d}", lastDate)
      Console.WriteLine("Last date (Julian): {0}-{1}-{2}", jc.GetDayOfMonth(lastDate),
                        jc.GetMonth(lastDate), jc.GetYear(lastDate))
      Console.WriteLine()
      
      Dim firstDate As DateTime = lastDate.AddDays(1)
      Console.WriteLine("First date (Gregorian): {0:d}", firstDate)
      Console.WriteLine("First date (Julian): {0}-{1}-{2}",  jc.GetDayOfMonth(firstDate),
                        jc.GetMonth(firstDate), jc.GetYear(firstDate))
   End Sub
End Module
' The example displays the following output:
'       Last date (Gregorian): 28-02-1700
'       Last date (Julian): 18-2-1700
'       
'       First date (Gregorian): 01-03-1700
'       First date (Julian): 19-2-1700

每個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,應用程式可以設定Calendar屬性,以新CalendarTo change the calendar used by a CultureInfo, the application can set the Calendar property to a new Calendar.

GetEra 會忽略標點符號紀元縮寫的名稱中,只有當GregorianCalendar中選取DateTimeFormatInfo.Calendar和文化特性會使用 「 A.D."GetEra ignores punctuation in abbreviated era names, only if the GregorianCalendar is selected in DateTimeFormatInfo.Calendar and the culture uses "A.D." 為紀元名稱時,也就是 「 A.D."as the era name, that is, "A.D." 相當於"AD"。is equivalent to "AD".

建構函式

GregorianCalendar() GregorianCalendar() GregorianCalendar() GregorianCalendar()

使用預設的 GregorianCalendar 值來初始化 GregorianCalendarTypes 類別的新執行個體。Initializes a new instance of the GregorianCalendar class using the default GregorianCalendarTypes value.

GregorianCalendar(GregorianCalendarTypes) GregorianCalendar(GregorianCalendarTypes) GregorianCalendar(GregorianCalendarTypes) GregorianCalendar(GregorianCalendarTypes)

使用指定的 GregorianCalendarTypes 值,初始化 GregorianCalendar 類別的新執行個體。Initializes a new instance of the GregorianCalendar class using the specified GregorianCalendarTypes value.

欄位

ADEra ADEra ADEra ADEra

代表目前的紀元。Represents the current era. 這個欄位是常數。This field is constant.

CurrentEra CurrentEra CurrentEra CurrentEra

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

(Inherited from Calendar)

屬性

AlgorithmType AlgorithmType AlgorithmType AlgorithmType

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

CalendarType CalendarType CalendarType CalendarType

取得或設定 GregorianCalendarTypes 值,代表目前 GregorianCalendar 的語言版本。Gets or sets the GregorianCalendarTypes value that denotes the language version of the current GregorianCalendar.

DaysInYearBeforeMinSupportedYear DaysInYearBeforeMinSupportedYear DaysInYearBeforeMinSupportedYear DaysInYearBeforeMinSupportedYear

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

(Inherited from Calendar)
Eras Eras Eras Eras

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

IsReadOnly IsReadOnly IsReadOnly IsReadOnly

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

(Inherited from Calendar)
MaxSupportedDateTime MaxSupportedDateTime MaxSupportedDateTime MaxSupportedDateTime

取得受 GregorianCalendar 型別所支援的最晚日期和時間。Gets the latest date and time supported by the GregorianCalendar type.

MinSupportedDateTime MinSupportedDateTime MinSupportedDateTime MinSupportedDateTime

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

TwoDigitYearMax TwoDigitYearMax TwoDigitYearMax 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) AddDays(DateTime, Int32) AddDays(DateTime, Int32) AddDays(DateTime, Int32)

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

(Inherited from Calendar)
AddHours(DateTime, Int32) AddHours(DateTime, Int32) AddHours(DateTime, Int32) AddHours(DateTime, Int32)

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

(Inherited from Calendar)
AddMilliseconds(DateTime, Double) AddMilliseconds(DateTime, Double) AddMilliseconds(DateTime, Double) AddMilliseconds(DateTime, Double)

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

(Inherited from Calendar)
AddMinutes(DateTime, Int32) AddMinutes(DateTime, Int32) AddMinutes(DateTime, Int32) AddMinutes(DateTime, Int32)

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

(Inherited from Calendar)
AddMonths(DateTime, Int32) AddMonths(DateTime, Int32) AddMonths(DateTime, Int32) AddMonths(DateTime, Int32)

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

AddSeconds(DateTime, Int32) AddSeconds(DateTime, Int32) AddSeconds(DateTime, Int32) AddSeconds(DateTime, Int32)

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

(Inherited from Calendar)
AddWeeks(DateTime, Int32) AddWeeks(DateTime, Int32) AddWeeks(DateTime, Int32) AddWeeks(DateTime, Int32)
AddYears(DateTime, Int32) AddYears(DateTime, Int32) AddYears(DateTime, Int32) AddYears(DateTime, Int32)

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

Clone() Clone() Clone() Clone()

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

(Inherited from Calendar)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
GetDayOfMonth(DateTime) GetDayOfMonth(DateTime) GetDayOfMonth(DateTime) GetDayOfMonth(DateTime)

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

GetDayOfWeek(DateTime) GetDayOfWeek(DateTime) GetDayOfWeek(DateTime) GetDayOfWeek(DateTime)

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

GetDayOfYear(DateTime) GetDayOfYear(DateTime) GetDayOfYear(DateTime) GetDayOfYear(DateTime)

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

GetDaysInMonth(Int32, Int32) GetDaysInMonth(Int32, Int32) GetDaysInMonth(Int32, Int32) GetDaysInMonth(Int32, Int32)

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

(Inherited from Calendar)
GetDaysInMonth(Int32, Int32, Int32) GetDaysInMonth(Int32, Int32, Int32) GetDaysInMonth(Int32, Int32, Int32) GetDaysInMonth(Int32, Int32, Int32)

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

GetDaysInYear(Int32) GetDaysInYear(Int32) GetDaysInYear(Int32) GetDaysInYear(Int32)

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

(Inherited from Calendar)
GetDaysInYear(Int32, Int32) GetDaysInYear(Int32, Int32) GetDaysInYear(Int32, Int32) GetDaysInYear(Int32, Int32)

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

GetEra(DateTime) GetEra(DateTime) GetEra(DateTime) GetEra(DateTime)

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

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetHour(DateTime) GetHour(DateTime) GetHour(DateTime) GetHour(DateTime)

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

(Inherited from Calendar)
GetLeapMonth(Int32) GetLeapMonth(Int32) GetLeapMonth(Int32) GetLeapMonth(Int32)

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

(Inherited from Calendar)
GetLeapMonth(Int32, Int32) GetLeapMonth(Int32, Int32) GetLeapMonth(Int32, Int32) GetLeapMonth(Int32, Int32)

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

GetMilliseconds(DateTime) GetMilliseconds(DateTime) GetMilliseconds(DateTime) GetMilliseconds(DateTime)

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

(Inherited from Calendar)
GetMinute(DateTime) GetMinute(DateTime) GetMinute(DateTime) GetMinute(DateTime)

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

(Inherited from Calendar)
GetMonth(DateTime) GetMonth(DateTime) GetMonth(DateTime) GetMonth(DateTime)

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

GetMonthsInYear(Int32) GetMonthsInYear(Int32) GetMonthsInYear(Int32) GetMonthsInYear(Int32)

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

(Inherited from Calendar)
GetMonthsInYear(Int32, Int32) GetMonthsInYear(Int32, Int32) GetMonthsInYear(Int32, Int32) GetMonthsInYear(Int32, Int32)

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

GetSecond(DateTime) GetSecond(DateTime) GetSecond(DateTime) GetSecond(DateTime)

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

(Inherited from Calendar)
GetType() GetType() GetType() GetType()

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

(Inherited from Object)
GetWeekOfYear(DateTime, CalendarWeekRule, DayOfWeek) GetWeekOfYear(DateTime, CalendarWeekRule, DayOfWeek) GetWeekOfYear(DateTime, CalendarWeekRule, DayOfWeek) GetWeekOfYear(DateTime, CalendarWeekRule, DayOfWeek)

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

GetYear(DateTime) GetYear(DateTime) GetYear(DateTime) GetYear(DateTime)

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

IsLeapDay(Int32, Int32, Int32) IsLeapDay(Int32, Int32, Int32) IsLeapDay(Int32, Int32, Int32) IsLeapDay(Int32, Int32, Int32)

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

(Inherited from Calendar)
IsLeapDay(Int32, Int32, Int32, Int32) IsLeapDay(Int32, Int32, Int32, Int32) IsLeapDay(Int32, Int32, Int32, Int32) IsLeapDay(Int32, Int32, Int32, Int32)

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

IsLeapMonth(Int32, Int32) IsLeapMonth(Int32, Int32) IsLeapMonth(Int32, Int32) IsLeapMonth(Int32, Int32)

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

(Inherited from Calendar)
IsLeapMonth(Int32, Int32, Int32) IsLeapMonth(Int32, Int32, Int32) IsLeapMonth(Int32, Int32, Int32) IsLeapMonth(Int32, Int32, Int32)

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

IsLeapYear(Int32) IsLeapYear(Int32) IsLeapYear(Int32) IsLeapYear(Int32)

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

(Inherited from Calendar)
IsLeapYear(Int32, Int32) IsLeapYear(Int32, Int32) IsLeapYear(Int32, Int32) IsLeapYear(Int32, Int32)

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

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
ToDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32) ToDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32) ToDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32) ToDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32)

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

(Inherited from Calendar)
ToDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32) ToDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32) ToDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32) 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) ToFourDigitYear(Int32) ToFourDigitYear(Int32) ToFourDigitYear(Int32)

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

ToString() ToString() ToString() ToString()

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

(Inherited from Object)

適用於

另請參閱