10.3.21 getWeekday (gets weekday from date)
Syntax
getWeekday [-l|-s] [date]
Description
This command outputs the day of date specified for argument with a character (numeric characters) or character string. If date of argument is omitted, the current date is assumed.
Arguments
- -l
-
This command outputs the character string indicating the official name of date.
- -s
-
This command outputs the character string indicating the abbreviation name of date.
If any of the aforementioned options is not specified, one digit character from 0 (Sunday) to 6 (Saturday) is output. If both of the aforementioned options are specified, the command finishes with an error.
Contents of each output follow behaviors of the date command in parts.
- date
-
This command specifies the character string indicating date.
Format of date with absolute date in the date command can be specified for date(Example: yyyy/mm/dd, yyyy-mm-dd, yyyymmdd, mm/dd/yyyy).
Output to the standard output
One-digit character (numeric characters) that indicates date or character string that indicates date.
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
getWeekday 2016/05/02 # "1" is output. getWeekday -l 2016/05/02 # "Monday" is output. getWeekday -s 2016/05/02 # "Mon" is output.