DelphiBasics
  Home  |  Delphi .net Home  |  System.Globalization NameSpace
 .NET Framework
 Namespace References

 System
 System.Collections
 System.Globalization
 
  Calendar  Class 
  CalendarWeekRule  Enumeration 
  CultureInfo  Class 
  CultureTypes  Enumeration 
  DateTimeFormatInfo  Class 
  DateTimeStyles  Enumeration 
  NumberFormatInfo  Class 
  NumberStyles  Enumeration 
  RegionInfo  Class 
  StringInfo  Class 
  TextElementEnumerator  Class 
  TextInfo  Class 
 System.Drawing - download only
 System.IO

 Articles and Tutorials

 Overview of .NET
 Delphi and .NET
 Winform Applications
 ASP .Net Applications
 ASP Web Services
 Framework Collections
 Framework String Handling
 Framework Files and Folders

 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 

 
 
  System.Globalization.Calendar Class
 
 Description
Calling writeTextBlock The Calendar class differs from the System.DateTime structure. The latter essentially holds the number of ticks (0.0000001 second) since 00:00:00 1st January 0001 AD. Calendar converts such a DateTime value internally into a different set of date/time divisions for the particular calendar format it is set up for.
 
Although Calendar is not a set of static methods, it is not so different. It does not hold a DateTime value - it merely processes such a value via its methods according to its Calendar culture criteria.
 
For example, the System.Globalization.HebrewCalendar is a pre-made Calendar that derives from Calendar that has between 353 and 355 days per common year, and 383 to 385 days in a leap year.
 
So Calendar maps the number of ticks since 00:00 1st Jan 0001 AD in a DateTime object to a particular calendar format.
 
Calendar is an abstract class that cannot be directly constructed. Since a calendar is literally culuture dependant, it is constructed using the System.Globalization.CultureInfo class, namely the Calendar property. It is also often constructed using the CultureInfo.InvariantCluture.Calendar static property - this does not require a CultureInfo object instance.
 
See System.Globalization.CultureInfo for an example of constructing a Calendar object.
 
There are a number of pre-built classes that derive from Calendar :
 
System.Globalization.GregorianCalendar 
System.Globalization.HebrewCalendar 
System.Globalization.HijriCalendar 
System.Globalization.JapaneseCalendar 
System.Globalization.JulianCalendar 
System.Globalization.KoreanCalendar 
System.Globalization.TaiwanCalendar 
System.Globalization.ThaiBuddhistCalendar 

 
Take a look at the GetYear method for examples of British and Arabic Calendars. After writeTextBlock
 Methods
AddDays  Add a number of Days to a DateTime value
AddHours  Add a number of Hours to a DateTime value
AddMilliSeconds  Add a number of MilliSeconds to a DateTime value
AddMinutes  Add a number of Minutes to a DateTime value
AddMonths  Add a number of Months to a DateTime value
AddSeconds  Add a number of Seconds to a DateTime value
AddWeeks  Add a number of Weeks to a DateTime value
AddYears  Add a number of Years to a DateTime value
GetDayOfMonth  Return the DateTime Day of month according to the current Calendar
GetDayOfWeek  Gets the specified DateTime Day of Week according to the current culture
GetDayOfYear  Gets the specified DateTime Day of Year according to the current culture
GetDaysInMonth  Gets the number of Days in a Month/Year according to the current Calendar
GetDaysInYear  Gets the number of Days in a Year according to the current Calendar
GetEra  Return the specified DateTime Era according to the current Calendar
GetHour  Gets the specified DateTime Hour
GetMilliSeconds  Gets the specified DateTime MilliSeconds
GetMinute  Gets the specified DateTime Minute
GetMonth  Return the specified DateTime Month according to the current Calendar
GetMonthsInYear  Gets the number of Months in a Year according to the current Calendar
GetSecond  Gets the specified DateTime Seconds
GetWeekOfYear  Return the DateTime Week of Year according to the current Calendar
GetYear  Return the specified DateTime Year according to the current Calendar
IsLeapMonth  Is specified Year/Month a leap Month according to the current Calendar?
IsLeapYear  Is specified Year a leap Year according to the current Calendar?
ToDateTime  Builds a DateTime object from year, month, day and time values
ToFourDigitYear  Converts a 2 digit year safely to a 4 digit year for the current Calendar

 Fields
CurrentEra  Integer  The current era (constant value)
 Properties
Eras  Array of Integer  Eras, starting with the most recent
TowDigitYearMax  Integer  Max value for conversion to 4 digits

 Delphi Basics links
 
System.Globalization.CultureInfo

 Microsoft MSDN links
 
System.Globalization
System.Globalization.Calendar
 
Delphi Programming Neil Moffatt 2002 - 2016. All rights reserved.  |  Home Page