Official Content

Adds hours to a DateTime attribute or variable.

Syntax

Date | DateTime.AddHours(Numeric-expression)

Where:

Date | DateTime
     
Is an attribute or variable based on the Date/DateTime data type, to which the method will add a certain number of hours.

Numeric-expression
     Is a Numeric expression that indicates the number of hours to be added to the Date | DateTime.

Type returned:
DateTime

Scope

Data Types: DateTime
Generators: .NET, .NET Framework, Java, RPG, Cobol, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)

Samples

&AppointmentDateTime = &AppointmentDateTime.AddHours(1)               //Adds 1 hours to &AppointmentDateTime variable
&AppointmentDateTime = &AppointmentDateTime.AddHours(&HoursNmbr + 1)  //&HoursNmbr is a variable received as a parameter using the Parm rule.

See Also

AddMinutes method
AddDays method





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