Official Content

Extracts the number that indicates the day in a given date. If the received parameter is null, the value returned is 0.

Syntax

Date | DateTime.Day()

Where:

Date | DateTime
     
Is a Date or DateTime expression to which the day number is extracted.

Type returned:
Numeric(2)

Scope

Data Types: Date, DateTime

Samples

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.
 

See Also

TimeZone Support - General Considerations
Day function
Month method
Year method

  



Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant