10.3.22 getYear (gets year from date)
Syntax
getYear [date]
Description
This command outputs the year of the date specified for argument with 4-digit character string (numeric characters). If the argument is omitted, the current date is assumed.
Arguments
- date
-
This command specifies the character string indicating date.
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
4-digit character string indicating hour (year).
Return codes
Return code |
Meaning |
---|---|
0 |
Normal termination |
Not less than 1 |
Termination with an error |
Notes
Although the character string that can be specified for date 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.
Examples
getYear 2016/05/02 # "2016" is output.