Business reports are prepared once a month, once a quarter or once a year. Analysts often compare business results against previous periods. First and last days of a given period are of special significance for reporting.
The dref_
prefix stands for date reference functions. The functions with the dref_
prefix return a reference date to the chosen date.
The functions work within three types of periods:
The functions return one of the four types of reference dates:
The names of functions combine the dref_
prefix and the first letters of the chosen reference date.
For example, dref_fdoy()
returns the first day of an year.
The table summarizes all date reference functions.
of month | of quarter | of year | |
---|---|---|---|
first day | dref_fdom() |
dref_fdoq() |
dref_fdoy() |
first working day | dref_fwdom() |
dref_fwdoq() |
dref_fwdoy() |
last day | dref_ldom() |
dref_ldoq() |
dref_ldoy() |
last working day | dref_lwdom() |
dref_lwdoq() |
dref_lwdoy() |
All functions take the argument date
, which is the base date. The functions return the result in reference to the base date. The functions always work within a specific period: a month, a quarter or an year.
The reference dates in the image below can be retrieved with the following functions:
dref_fdom()
- dark bluedref_fwdom()
- light bluedref_ldom()
- light greendref_lwdom()
- dark greenThe base date has been marked with orange.
The reference dates in the image below can be retrieved with the following functions:
dref_fdoq()
- dark bluedref_fwdoq()
- light bluedref_ldoq()
- light greendref_lwdoq()
- dark greenThe base date has been marked with orange.
Watch out! The first day of a year is the same as the first working day of a year. The last day of a year is the same as the last working day of a year. Hence, the same day is marked with two colors (darker and lighter).
The reference dates in the image below can be retrieved with the following functions:
dref_fdoy()
- dark bluedref_fwdoy()
- light bluedref_ldoy()
- light greendref_lwdoy()
- dark greenThe base date has been marked with orange.
Watch out! The first day of a year is the same as the first working day of a year. The last day of a year is the same as the last working day of a year. Hence, the same day is marked with two colors (darker and lighter).