Description
Provides helper methods for a date.
Public Methods
Add | Adds the value in the given unit and returns a new date interface. |
Format | Returns the value of the date given the unit. |
SetDate | Sets this date with the given date value and unit type. |
Span | Subtracts the value from the IAgDate interface and returns an IAgQuantity. |
Subtract | Subtracts the value in the given unit and returns a new date interface. |
Public Properties
OLEDate | Gets or sets the current time in OLE DATE Format. |
SecIntoDay | Contains values between 0.0 and 86400 with the exception of when the date is inside a leap second in which case the SecIntoDay can become as large as 86401.0. |
SecIntoDayUTC | Contains values between 0.0 and 86400 with the exception of when the date is inside a leap second in which case the SecIntoDay can become as large as 86401.0. |
WholeDays | Gets or sets the Julian Day Number of the date of interest. |
WholeDaysUTC | Gets or sets the UTC Day Number of the date of interest. |
Example
Calculate date subtraction (with IAgDate)
[C#] |
---|
// Create a date representing now
IAgDate nowDate = root.ConversionUtility.NewDate("DD/MM/YYYY", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss.fff"));
// Dates can be modified using Subtract 52 days
IAgDate newDate = nowDate.Subtract("day", 52.0);
// Differences between dates are calculated from Span function
IAgQuantity span = newDate.Span(nowDate);
// IAgDate also provides formatting functionalities
span.ConvertToUnit("min");
Console.WriteLine("Date(now) in UTCG is: {0}", nowDate.Format("UTCG"));
Console.WriteLine("Date(52 days before now) in UTCG is: {0}", newDate.Format("UTCG"));
Console.WriteLine("The difference between now and 52 days ago is {0} minutes!", span.Value);
|
|
Calculate date addition (with IAgDate)
[C#] |
---|
// Create a date representing now
IAgDate nowDate = root.ConversionUtility.NewDate("DD/MM/YYYY", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss.fff"));
// Dates can be modified using Add 52 days
IAgDate newDate = nowDate.Add("day", 52.0);
// Differences between dates are calculated from Span function
IAgQuantity span = newDate.Span(nowDate);
// IAgDate also provides formatting functionalities
span.ConvertToUnit("min");
Console.WriteLine("Date(now) in UTCG is: {0}", nowDate.Format("UTCG"));
Console.WriteLine("Date(52 days from now) in UTCG is: {0}", newDate.Format("UTCG"));
Console.WriteLine("The difference between now and 52 days to come is {0} minutes!", span.Value);
|
|
Calculate date subtraction (with IAgDate)
[Visual Basic .NET] |
---|
' Create a date representing now
Dim nowDate As IAgDate = root.ConversionUtility.NewDate("DD/MM/YYYY", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss.fff"))
' Dates can be modified using Subtract 52 days
Dim newDate As IAgDate = nowDate.Subtract("day", 52)
' Differences between dates are calculated from Span function
Dim span As IAgQuantity = newDate.Span(nowDate)
' IAgDate also provides formatting functionalities
span.ConvertToUnit("min")
Console.WriteLine("Date(now) in UTCG is: {0}", nowDate.Format("UTCG"))
Console.WriteLine("Date(52 days before now) in UTCG is: {0}", newDate.Format("UTCG"))
Console.WriteLine("The difference between now and 52 days ago is {0} minutes!", span.Value)
|
|
Calculate date addition (with IAgDate)
[Visual Basic .NET] |
---|
' Create a date representing now
Dim nowDate As IAgDate = root.ConversionUtility.NewDate("DD/MM/YYYY", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss.fff"))
' Dates can be modified using Add 52 days
Dim newDate As IAgDate = nowDate.Add("day", 52)
' Differences between dates are calculated from Span function
Dim span As IAgQuantity = newDate.Span(nowDate)
' IAgDate also provides formatting functionalities
span.ConvertToUnit("min")
Console.WriteLine("Date(now) in UTCG is: {0}", nowDate.Format("UTCG"))
Console.WriteLine("Date(52 days from now) in UTCG is: {0}", newDate.Format("UTCG"))
Console.WriteLine("The difference between now and 52 days to come is {0} minutes!", span.Value)
|
|