< previous page page_95 next page >

Page 95
Listing 5.8 day_of_week_name()
/* downame.C


   +-------------------------------------------+
   |   Copyright (C) 1995 by Lance W. Latham.  |
   |         All rights reserved.              |
   +-------------------------------------------+


     Returns the name of the day of the week for a given numeric index.


     INPUTS:


     1. day_index, type int, an integer value coding the day of the week,
        as follows:


        0 = Sunday
        1 = Monday
        2 = Tuesday
        3 = Wednesday
        4 = Thursday
        5 = Friday
        6 = Saturday


   OUTPUTS:


   1. Returned by routine, string, containing the name of the day of
      the week which corresponds to the input index.


   NOTES:
   1. Returns 'NULL' for indices outside the valid range of 0  6.


   2. Use the function 'day_of_week_index ()' to obtain the index for a
      given date in the Gregorian calendar system. Use the function
      'day_of_week_index_JD0 ()' to obtain the same index for a date
      in the Julian or Gregorian calendar systems.


   3. If a buffer is designated to hold the value returned by this routine,
      sufficient space must be allocated to hold the longest string which
      can be returned by this function. The longest day name is 'Wednesday',
      so the allocated area must allow for 10 characters, including the
      terminating null.


   4. Names of the day of the week are in English.


   5. This routine uses the standard SCDTL convention that Sunday is the
      first day of the week (DOW).
*/

 
< previous page page_95 next page >