10.3.12 getCalcDate (gets the calculated date)
Syntax
getCalcDate date [+|-]number-of-years [+|-]number-of-months [+|-]number-of-days
Description
This command outputs the date calculated by calculating number-of-years, number-of-months, number-of-days specified for argument to date specified for argument in the format yyyy/mm/dd.
Arguments
- date
-
This command specifies the character string indicating date.
- number-of-years
-
Specify a value not less than 0 that indicates number of years.
- number-of-months
-
Specify a value not less than 0 that indicates number of months.
- number-of-days
-
Specify a value not less than 0 indicating number of days.
Syntax of date can be specified with absolute date in the date command to date (Example: yyyy/mm/dd, yyyy-mm-dd, yyyymmdd, mm/dd/yyyy).
Output to the standard output
Character string that indicates the calculated date.
Return codes
Return code |
Meaning |
---|---|
0 |
Normal termination |
Not less than 1 |
Termination with an error |
Notes
-
If the date exceeds the last day of the month after calculating the number of days and number of months, the excess is added to the next month and output.
For example, if you specify "2015/03/31 0 -1 0" for argument, 3 days exceeded from the last day "February 28, 2015" is added to the next month and "2015/03/03" is output.
-
Although the character string that can be specified for date of argument is the same as that of the date format based on absolute date with the date command, whether the character string can be specified is not verified.
-
A value of not less than 0 can be specified for number of years, number of months and number of days for argument, but whether the character string can be specified is not verified.
Examples
getCalcDate 2016/05/02 +1 -4 18 # "2017/01/20" is output. getCalcDate 2016/05/02 0 -6 0 # "2015/11/02" is output.