System.Globalization Namespace
Represents time in divisions, such as weeks, months, and years.
Visibility |
Name |
Parameters |
Return Type |
public |
AddDays |
(
DateTime
time
,
Int32
days
)
|
DateTime
|
public |
AddHours |
(
DateTime
time
,
Int32
hours
)
|
DateTime
|
public |
AddMilliseconds |
(
DateTime
time
,
Double
milliseconds
)
|
DateTime
|
public |
AddMinutes |
(
DateTime
time
,
Int32
minutes
)
|
DateTime
|
public |
AddMonths |
(
DateTime
time
,
Int32
months
)
|
DateTime
|
public |
AddSeconds |
(
DateTime
time
,
Int32
seconds
)
|
DateTime
|
public |
AddWeeks |
(
DateTime
time
,
Int32
weeks
)
|
DateTime
|
public |
AddYears |
(
DateTime
time
,
Int32
years
)
|
DateTime
|
public |
Clone |
( )
|
Object
|
public |
GetDayOfMonth |
(
DateTime
time
)
|
Int32
|
public |
GetDayOfWeek |
(
DateTime
time
)
|
DayOfWeek
|
public |
GetDayOfYear |
(
DateTime
time
)
|
Int32
|
public |
GetDaysInMonth |
(
Int32
year
,
Int32
month
,
Int32
era
)
|
Int32
|
public |
GetDaysInMonth |
(
Int32
year
,
Int32
month
)
|
Int32
|
public |
GetDaysInYear |
(
Int32
year
)
|
Int32
|
public |
GetDaysInYear |
(
Int32
year
,
Int32
era
)
|
Int32
|
public |
GetEra |
(
DateTime
time
)
|
Int32
|
public |
GetHour |
(
DateTime
time
)
|
Int32
|
public |
GetLeapMonth |
(
Int32
year
,
Int32
era
)
|
Int32
|
public |
GetLeapMonth |
(
Int32
year
)
|
Int32
|
public |
GetMilliseconds |
(
DateTime
time
)
|
Double
|
public |
GetMinute |
(
DateTime
time
)
|
Int32
|
public |
GetMonth |
(
DateTime
time
)
|
Int32
|
public |
GetMonthsInYear |
(
Int32
year
,
Int32
era
)
|
Int32
|
public |
GetMonthsInYear |
(
Int32
year
)
|
Int32
|
public |
GetSecond |
(
DateTime
time
)
|
Int32
|
public |
GetWeekOfYear |
(
DateTime
time
,
CalendarWeekRule
rule
,
DayOfWeek
firstDayOfWeek
)
|
Int32
|
public |
GetYear |
(
DateTime
time
)
|
Int32
|
public |
IsLeapDay |
(
Int32
year
,
Int32
month
,
Int32
day
,
Int32
era
)
|
Boolean
|
public |
IsLeapDay |
(
Int32
year
,
Int32
month
,
Int32
day
)
|
Boolean
|
public |
IsLeapMonth |
(
Int32
year
,
Int32
month
)
|
Boolean
|
public |
IsLeapMonth |
(
Int32
year
,
Int32
month
,
Int32
era
)
|
Boolean
|
public |
IsLeapYear |
(
Int32
year
)
|
Boolean
|
public |
IsLeapYear |
(
Int32
year
,
Int32
era
)
|
Boolean
|
public static |
ReadOnly |
(
Calendar
calendar
)
|
Calendar
|
public |
ToDateTime |
(
Int32
year
,
Int32
month
,
Int32
day
,
Int32
hour
,
Int32
minute
,
Int32
second
,
Int32
millisecond
,
Int32
era
)
|
DateTime
|
public |
ToDateTime |
(
Int32
year
,
Int32
month
,
Int32
day
,
Int32
hour
,
Int32
minute
,
Int32
second
,
Int32
millisecond
)
|
DateTime
|
public |
ToFourDigitYear |
(
Int32
year
)
|
Int32
|
|
A calendar divides time into measures, such as weeks, months, and years. The number, length, and start of the divisions vary in each calendar.
Any moment in time can be represented as a set of numeric values using a particular calendar. For example, the last vernal equinox occurred at ( 0.0, 0, 46, 8, 20, 3, 1999 ) in the Gregorian calendar. An implementation of Calendar can map any DateTime value to a similar set of numeric values, and DateTime can map such sets of numeric values to a textual representation ( for example, "8:46 AM March 20th 1999 AD" for the English ( United States ) culture ) using DateTimeFormatInfo.
A Calendar implementation can define one or more eras. The Calendar class identifies the eras as enumerated integers where the current era ( CurrentEra ) has the value 0.
In order to make up for the difference between the calendar year and the actual time that the earth rotates around the sun or the actual time that the moon rotates around the earth, a leap year has a different number of days than a standard calendar year. Each Calendar implementation defines leap years differently.
For consistency, the first unit in each interval ( for example, the first month ) is assigned the value 1.
The System.Globalization namespace includes the following Calendar implementations: GregorianCalendar, HebrewCalendar, HijriCalendar, JapaneseCalendar, JulianCalendar, KoreanCalendar, TaiwanCalendar, and ThaiBuddhistCalendar.
DateTime DateTimeFormatInfo GregorianCalendar HebrewCalendar HijriCalendar JapaneseCalendar JulianCalendar KoreanCalendar TaiwanCalendar ThaiBuddhistCalendar
|
|