Returns the numeric month identifier in a given date.
Month(Date-Expression | Datetime-Expression)
Type Returned:
Numeric(2)
A null value (0) is returned if the received parameter is null.
Objects: Procedure, Transaction, Web Panel, Panel, Data Provider
Generators: .NET, .NET Framework, Java, Apple, Android,
Angular
1)
&Month = Month(CToD('01/01/08')) // Result &Month: 1
&Month = Month(Now()) // Result &Month: 2 If Now() = 25/02/08 10:30
2)
Suppose you need to define a list of all the Customers whose birthdays are in the current month (in this example, the current month is October).
Consider the following Transaction object:
Customer
{
CustomerId*
CustomerName
CustomerDateOfBirth
CustomerEmail
}
Create a Procedure object and define the following in its Layout:
Next, in the Source section of the Procedure object, include the following code:
Print printBlock1
For each Customer
Where Month(CustomerDateofBirth) = Month(&Today)
Print printBlock2
EndFor
The Today variable (&Today), shown above, is a pre-defined GeneXus variable that stores the current date.
The following image shows the list at runtime:
TimeZone Support - General Considerations
Month method
Year function
Day function