syntax:functions:addhours
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
Argument | Type | Description |
---|---|---|
date | Date 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:
- A date string: #2019-12-12
- A date serial value: 43811 (the date serial for "2019-12-12")
- A date value created using any of the Date/Time functions that returns a date serial value.
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
syntax/functions/addhours.txt · Last modified: 2021/08/30 01:53 by craigt