Extracts the number that indicates the day in a given date. If the received parameter is null, the value returned is 0.
Date | DateTime.Day()
Where:
Date | DateTime
Is a Date or DateTime expression to which the day number is extracted.
Type returned:
Numeric(2)
Data Types: Date, DateTime
Suppose a company wants to implement the following discount policy: "All debts paid before the 21st of every month, will have a 15% discount".
Consider the following Transaction object:
Payment
{
PaymentId*
PaymentDate
PaymentAmount
}
The following code is defined inside an Event of the Payment Transaction or a Web Panel with base table:
If PaymentDate.Day() < 21
&Discount = PaymentAmount * 0.15
else
&Discount = 0
EndIf
The Day method may be also applied to the result returned by an expression as follows:
&Nbr = PaymentDate.AddDays(&NbrOfDays).Day()
In this example, first the AddDays method is applied to the PaymentDate attribute (&NbrOfDays is a Numeric variable received by parameter using the Parm rule). The result is a new Date with some days added and the Day method is applied to that new date, returning the number that indicates the day.
TimeZone Support - General Considerations
Day function
Month method
Year method