Returns a string for the weekday specified.

You're viewing an older version of this page (#200). View the current version.

View versions (1)

Interface

#include <codecogs/units/date/weekday_str.h>

using namespace Units::Date;

Returns a string pointer to the description of the numeric week day specified, i.e. "Sunday", "Monday", "Tuesday"

Example 1

#include <stdio.h>
#include <codecogs/units/date/weekday_str.h>
#include <codecogs/units/date/dayofweek.h>
#include <codecogs/units/date/date.h>
using namespace Units::Date;

int main()
{
  int adate=date("10 october 2004");
  for(int i=0;i<10;i++)
    printf("\n %d october 2005 occurs on a %s", 10+i, weekday_str(dayOfWeek(adate+i,3),3));
  return 0;
}

Output:

10 october 2004 occurs on a Sunday
11 october 2004 occurs on a Monday
12 october 2004 occurs on a Tuesday
13 october 2004 occurs on a Wednesday
14 october 2004 occurs on a Thursday
15 october 2004 occurs on a Friday
16 october 2004 occurs on a Saturday
17 october 2004 occurs on a Sunday
18 october 2004 occurs on a Monday
19 october 2004 occurs on a Tuesday

Parameters

weekDay
is the numeric day of the week, within the range specified by the type. Values outside this range are wrapped back into range. So WeekDay=13 is the same as WeekDay=5;
type
Default Value = 1
GPL Licence — free for non commercial use. See Licence details.