Table of Contents

AddHours(date, add_hours)

Category: Date and Time function


Description

This function adds add_hours number of hours to date. If add_hours is negative, the hours are subtracted.


Arguments

ArgumentTypeDescription
dateDate or Number (date serial)A expression representing a date. The date to add hours to.
add_hours Number The number of hours to be added to date, or subtracted if negative.

Return value type: Number (date serial value).


Remarks

The date argument can take any value or expression that evaluates to a date serial value, with or without a time portion. Examples include:


Examples

addhours(#2019-12-12, 3)  //Returns 43811.125 (Equivalent to 2019-Dec-12 03:00:00.)
addhours(43811, 6)  //Returns 43811.25 (Equivalent to 2019-Dec-12 06:00:00.)
addhours(#2019-12-12, -12)  //Returns 43810.5 (Equivalent to 2019-Dec-11 12:00:00; subtract hours.)
addhours(43811.5, 6)  //Returns 43811.75 (The source date includes a time portion.)
addhours( date("2019-12-12","yyyy-MM-dd") , 3)  //Returns 43811.125 (Using the date function.)


See also