Click or drag to resize

GregorianDate Structure

Represents a calendar date in the Gregorian calendar. A GregorianDate does not include a TimeStandard as JulianDate does. However, without explicitly specifying a TimeStandard for the date, the GregorianDate is assumed to be represented in CoordinatedUniversalTime. GregorianDate is also capable of representing leap seconds, which are represented as the second measured from 60 to 61. In this case, the GregorianDate is assumed to be the CoordinatedUniversalTime represented in InternationalAtomicTime which can represent leap seconds exactly.

Namespace:  AGI.Foundation.Time
Assembly:  AGI.Foundation.Core (in AGI.Foundation.Core.dll) Version: 24.2.419.0 (24.2.419.0)
Syntax
public struct GregorianDate : IComparable<GregorianDate>, 
	IComparable, IEquatable<GregorianDate>

The GregorianDate type exposes the following members.

Constructors
  NameDescription
Public methodGregorianDate(DateTime)
Initializes a GregorianDate from the provided DateTime. If the provided DateTime is in local time, it is converted to UTC.
Public methodGregorianDate(JulianDate)
Initializes a GregorianDate from the provided JulianDate. The new GregorianDate will be in the CoordinatedUniversalTime (UTC) time standard.
Public methodGregorianDate(Int32, Double)
Initializes a GregorianDate from the provided values. The fractional portion of the daysOfYear will be converted into hours, minutes, and seconds.
Public methodGregorianDate(JulianDate, TimeStandard)
Initializes a GregorianDate from the provided JulianDate. The new GregorianDate will be in the provided TimeStandard.
Public methodGregorianDate(Int32, Int32, Int32)
Initializes a GregorianDate from the provided values. The remaining values are assumed to be zero.
Public methodGregorianDate(Int32, Int32, Int32, Int32, Double)
Initializes a GregorianDate from the provided values.
Public methodGregorianDate(Int32, Int32, Int32, Int32, Int32, Double)
Initializes a GregorianDate from the provided values.
Top
Properties
  NameDescription
Public propertyDay
Gets the day of the month (in the range 1 through the number of days in the month).
Public propertyDayOfWeek
Gets the day of the week represented by this instance.
Public propertyDayOfYear
Gets the day of the year represented by this instance.
Public propertyHour
Gets the hour (in the range 0 through 23).
Public propertyJulianSecondsOfDay
Gets the corresponding seconds past noon for this instance.
Public propertyMinute
Gets the minute (in the range 0 through 59).
Public propertyMonth
Gets the month of the year (in the range 1 through 12).
Public propertyStatic memberNow
Gets the GregorianDate that represents the current date and time.
Public propertySecond
Gets the second, including fractional seconds (in the range 0.0 up to, but not including, 61.0). A value between 60.0 and 61.0 indicates a leap second.
Public propertySecondsOfDay
Gets the corresponding seconds past midnight for this instance.
Public propertyYear
Gets the year.
Top
Methods
  NameDescription
Public methodAddDays
Adds the specified number of days to this date and returns the new date.
Public methodAddHours
Adds the specified number of hours to this date and returns the new date.
Public methodAddMinutes
Adds the specified number of minutes to this date and returns the new date.
Public methodAddSeconds
Adds the specified number of seconds to this date and returns the new date.
Public methodCompareTo(GregorianDate)
Compares this instance with another instance of the same type.
Public methodCompareTo(Object)
Compares this instance with another instance of the same type.
Public methodEquals(GregorianDate)
Indicates whether another instance of this type is exactly equal to this instance.
Public methodEquals(Object)
Indicates whether another object is exactly equal to this instance.
(Overrides ValueTypeEquals(Object).)
Public methodGetHashCode
Returns a hash code for this instance, which is suitable for use in hashing algorithms and data structures like a hash table.
(Overrides ValueTypeGetHashCode.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberIsValid
Indicates whether the date values provided are a valid representation of a date and time.
Public methodStatic memberParse(String)

Converts the specified string representation of a date and time to its GregorianDate equivalent.

Note: GregorianDate is always assumed to be in UTC. You cannot parse strings containing time zone information. However, this will handle three common ISO8601 formats:

  • the extended format "YYYY-MM-DDThh:mm:ss.sZ"
  • The "day of year" equivalent "YYYY-DDDThh:mm:ss.sZ"
  • The basic format "YYYYMMDDThhmmss.sZ"
Public methodStatic memberParse(String, IFormatProvider)

Converts the specified string representation of a date and time to its GregorianDate equivalent using the specified culture-specific format information.

Note: GregorianDate is always assumed to be in UTC. You cannot parse strings containing time zone information. However, this will handle three common ISO8601 formats:

  • the extended format "YYYY-MM-DDThh:mm:ss.sZ"
  • The "day of year" equivalent "YYYY-DDDThh:mm:ss.sZ"
  • The basic format "YYYYMMDDThhmmss.sZ"
Public methodStatic memberParseExact(String, String, IFormatProvider)

Converts the specified string representation of a date and time to its GregorianDate equivalent using the specified format and culture-specific format information. The format of the string representation must match the specified format exactly.

Note: GregorianDate is always assumed to be in UTC. You cannot parse strings containing time zone information.

Public methodStatic memberParseExact(String, String, IFormatProvider)

Converts the specified string representation of a date and time to its GregorianDate equivalent using the specified format and culture-specific format information. The format of the string representation must match the specified format exactly.

Note: GregorianDate is always assumed to be in UTC. You cannot parse strings containing time zone information.

Public methodRoundSeconds(Int32)
Rounds this instance to the specified number of decimal digits in the seconds, rolling over to minutes, hours, days, etc. as necessary. This instance is assumed to express a time in the CoordinatedUniversalTime (UTC) time standard so the Second will be allowed to go above 60 during a leap second.
Public methodRoundSeconds(Int32, TimeStandard)
Rounds this instance to the specified number of decimal digits in the seconds, rolling over to minutes, hours, days, etc. as necessary. If the specified timeStandard is CoordinatedUniversalTime, (UTC), the seconds will be allowed to go above 60 during a leap second. For any other time standard, the Second will be below 60.
Public methodSubtractDays
Subtracts the specified number of days from this date and returns the new date.
Public methodSubtractHours
Subtracts the specified number of hours from this date and returns the new date.
Public methodSubtractMinutes
Subtracts the specified number of minutes from this date and returns the new date.
Public methodSubtractSeconds
Subtracts the specified number of seconds from this date and returns the new date.
Public methodToDateTime
Convert this GregorianDate to a DateTime. The DateTime will be in UTC.
Public methodToIso8601String
Converts the value of this instance to its equivalent ISO8601 extended string representation, with fractional seconds represented to 15 digits.
Public methodToIso8601String(Iso8601Format)
Converts the value of this instance to its equivalent ISO8601 string representation, with fractional seconds represented to 15 digits.
Public methodToIso8601String(Iso8601Format, Int32)
Converts the value of this instance to its equivalent ISO8601 string representation, with fractional seconds represented to the specified number of digits.
Public methodToJulianDate
Convert this GregorianDate to a JulianDate. The time standard will be CoordinatedUniversalTime (UTC), unless this GregorianDate represents the instant of a leap second, in which case the JulianDate will be in InternationalAtomicTime (TAI).
Public methodToJulianDate(TimeStandard)
Convert this GregorianDate to a JulianDate. The GregorianDate is assumed to specify a time in the specified TimeStandard.
Public methodToLongDateString
Converts the value of this instance to its equivalent long date string representation.
Public methodToLongTimeString
Converts the value of this instance to its equivalent long time string representation.
Public methodToShortDateString
Converts the value of this instance to its equivalent short date string representation.
Public methodToShortTimeString
Converts the value of this instance to its equivalent short time string representation.
Public methodToString
Converts the value of this instance to its equivalent string representation.
(Overrides ValueTypeToString.)
Public methodToString(IFormatProvider)
Converts the value of this instance to its equivalent string representation using the specified culture-specific format information.
Public methodToString(String)
Converts the value of this instance to its equivalent string representation using the specified format.
Public methodToString(String, IFormatProvider)
Converts the value of this instance to its equivalent string representation using the specified format and culture-specific format information.
Public methodStatic memberTryParse(String, GregorianDate)

Converts the specified string representation of a date and time to its GregorianDate equivalent.

Note: GregorianDate is always assumed to be in UTC. You cannot parse strings containing time zone information. However, this method handles three common ISO8601 formats:

  • the extended format "YYYY-MM-DDThh:mm:ss.sZ"
  • The "day of year" equivalent "YYYY-DDDThh:mm:ss.sZ"
  • The basic format "YYYYMMDDThhmmss.sZ"
Public methodStatic memberTryParse(String, IFormatProvider, GregorianDate)

Converts the specified string representation of a date and time to its GregorianDate equivalent using the specified culture-specific format information.

Note: GregorianDate is always assumed to be in UTC. You cannot parse strings containing time zone information. However, this method handles three common ISO8601 formats:

  • the extended format "YYYY-MM-DDThh:mm:ss.sZ"
  • The "day of year" equivalent "YYYY-DDDThh:mm:ss.sZ"
  • The basic format "YYYYMMDDThhmmss.sZ"
Top
Operators
  NameDescription
Public operatorStatic memberEquality
Returns if the two instances are exactly equal.
Public operatorStatic memberGreaterThan
Returns if left is greater than right.
Public operatorStatic memberGreaterThanOrEqual
Returns if left is greater than or equal to right.
Public operatorStatic memberInequality
Returns if the two instances are not exactly equal.
Public operatorStatic memberLessThan
Returns if left is less than right.
Public operatorStatic memberLessThanOrEqual
Returns if left is less than or equal to right.
Top
Fields
  NameDescription
Public fieldStatic memberMaxValue
Represents the largest possible value of GregorianDate. Corresponds to MaxValue.
Public fieldStatic memberMinValue
Represents the smallest possible value of GregorianDate. Corresponds to MinValue.
Top
See Also