xref: /PHP-8.3/ext/calendar/dow.c (revision a5e8ac62)
1 /* $selId: dow.c,v 2.0 1995/10/24 01:13:06 lees Exp $
2  * Copyright 1993-1995, Scott E. Lee, all rights reserved.
3  * Permission granted to use, copy, modify, distribute and sell so long as
4  * the above copyright and this permission statement are retained in all
5  * copies.  THERE IS NO WARRANTY - USE AT YOUR OWN RISK.
6  */
7 
8 /**************************************************************************
9  *
10  * These are the externally visible components of this file:
11  *
12  *     int
13  *     DayOfWeek(
14  *         long int sdn);
15  *
16  * Convert a SDN to a day-of-week number (0 to 6).  Where 0 stands for
17  * Sunday, 1 for Monday, etc. and 6 stands for Saturday.
18  *
19  *     char *DayNameShort[7];
20  *
21  * Convert a day-of-week number (0 to 6), as returned from DayOfWeek(), to
22  * the abbreviated (three character) name of the day.
23  *
24  *     char *DayNameLong[7];
25  *
26  * Convert a day-of-week number (0 to 6), as returned from DayOfWeek(), to
27  * the name of the day.
28  *
29  **************************************************************************/
30 
31 #include "sdncal.h"
32 
DayOfWeek(zend_long sdn)33 int DayOfWeek(
34 				 zend_long sdn)
35 {
36 	return (int)(sdn % 7 + 8) % 7;
37 }
38 
39 const char * const DayNameShort[7] =
40 {
41 	"Sun",
42 	"Mon",
43 	"Tue",
44 	"Wed",
45 	"Thu",
46 	"Fri",
47 	"Sat"
48 };
49 
50 const char * const DayNameLong[7] =
51 {
52 	"Sunday",
53 	"Monday",
54 	"Tuesday",
55 	"Wednesday",
56 	"Thursday",
57 	"Friday",
58 	"Saturday"
59 };
60