Blinking snake

Weekday

NAME

weekday - find days of week in year or month, or days of month in year

SYNTAX

weekday [-h?ymrbjv] <dow> <dom>

Dow is the day of the week, and may be a number (0-6), a day name (sunday-saturday), the string “none”, or the string “payday”; it may also be not present, in which case it defaults to 0, or sunday.

Dom is the day of the month, and may be a number (1-31), the string “all”, the string “end”, the string “beg”, the string “mid”, or not present, in which case it defaults to “all” or 13, depending on other command-line arguments.

If no command-line arguments are supplied, weekday sets the day of the month to 13, the day of the week to Friday, and the year to the current one, and will therefore output a list of all Friday the thirteenths in the current year.

DESCRIPTION

This program allows the user to find specific weekdays in a year or month, or to find what calendar days fall on particular days of a month.

—Ivan Tue Nov 14 06:41:41 CST 1989 (Gregorian)
12.18.16.10.0 1 Ahau 18 Zac (Maya Long Count)

OPTIONS

-h or -?
Print a help message and die. -h goes to stdout, and -? goes to stderr.
-v
Print the version number and die.
-b
“BC” mode; outputs the year as “0001 BC” instead of “0000,” or “4713 BC” instead of “-4712.” This isn’t true “Gregorian Proleptic,” but it’s convenient.
-y<##>
Sets the year to <##>; whitespace after the option keyletter is fine (as for all keyletters taking parameters). Input years may be either in “BC” format or in Astronomical format; for BC format, simply follow the year of the input date with the letter “b”, instead of the “-” preceding the year, when input years are before 1 AD.
-m<string>
Sets the month you are interested in to <string>; <string> can be a number (1-12) or a month name (jan-dec); if the -m option is present, a parameter is required. The parser is case-insensitive, and matches only the first three letters of a monthname, so “jan”, “January”, “JaNsldkfj” and “1” are equivalent.
-r
Restricts the output list such that only one month is matched; if the -m option is not supplied, then the month to be matched is taken to be the current month.
-j
Dates output are in the Julian calendar, not Gregorian; input dates are considered to be Julian style, including the default current date if no arguments are supplied.

EXAMPLES

% weekday
             second Friday   : 13    January 1989[  13 ]
        forty-first Friday   : 13    October 1989[ 286 ]
% weekday -y 1990
          fifteenth Friday   : 13      April 1990[ 103 ]
      twenty-eighth Friday   : 13       July 1990[ 194 ]
% weekday monday 9
             second Monday   :  9    January 1989[   9 ]
        forty-first Monday   :  9    October 1989[ 282 ]
% weekday sunday
              first Sunday   :  1    January 1989[   1 ]
             second Sunday   :  8    January 1989[   8 ]
              third Sunday   : 15    January 1989[  15 ]
                    . . . . . . . .
        fifty-third Sunday   : 31   December 1989[ 365 ]
% weekday payday end
Thursday :  30   November 1989[ 334 ]
Friday   :  29   December 1989[ 363 ]
% weekday -y 1990 -m jan payday middle
Monday   :  15    January 1990[  15 ]
Thursday :  15   February 1990[  46 ]
Thursday :  15      March 1990[  74 ]
Friday   :  13      April 1990[ 103 ]
Tuesday  :  15        May 1990[ 135 ]
Friday   :  15       June 1990[ 166 ]
Friday   :  13       July 1990[ 194 ]
Wednesday:  15     August 1990[ 227 ]
Friday   :  14  September 1990[ 257 ]
Monday   :  15    October 1990[ 288 ]
Thursday :  15   November 1990[ 319 ]
Friday   :  14   December 1990[ 348 ]
% weekday payday 5
Tuesday  :   5   November 1996[ 310 ]
Thursday :   5   December 1996[ 340 ]
% weekday payday 20
Wednesday:  20   November 1996[ 325 ]
Friday   :  20   December 1996[ 355 ]

BUGS & SPECIAL CONSIDERATIONS

The ? in the -? must be escaped (preceded by a \) to prevent interference by the shell.

SEE ALSO

ncal(I), bxy(I), easter(I), jug(I), grj(I)

PLATFORMS SUPPORTED

UnixWare®

AUTHOR

Ivan Van Laningham. If you would like the C source, email me.

Previous Page
Table of Contents
Next Page

Main web site:  http://www.pauahtun.org

Valid HTML 4.01 Transitional