FUNCTION
dayOfWeek
Computes the day of the week (Sunday through to Monday), for the specified serial Julian date.
You're viewing an older version of this page (#196). View the current version.
Interface
#include <codecogs/units/date/dayofweek.h>
using namespace Units::Date;
Calculates the week day from a serial Julian date. This is correct for both the Gregorian and Julian calendar. The solution is merely:
(1)
Example 1
#include <stdio.h>
#include <codecogs/units/date/dayofweek.h>
#include <codecogs/units/date/date.h>
using namespace Units::Date;
int main()
{
for(int i=10;i<20;i++)
{
int adate=date(2004, 10, i);
printf("\n %d October 2004 is %d day of week", i, dayOfWeek(adate));
}
return 0;
}Parameters
nDate
is a serial number of days from 24 November 4714 BC (1 January 4713BC in the Julian Calendar) - also known as the Julian Period.
type
defines the output style for the day of the week
Blank
- Type=1 (default) : return contains numbers 1 (Sunday) through 7 (Saturday).
- Type=2 : return contains numbers 1 (Monday) through 7 (Sunday).
- Type=3 : return contains numbers 0 (Monday) through 6 (Sunday).
Interactive Calculator
nDate
type
Result
Computing…
Set a range above first to export a graph.
This function's source code is only visible to registered users — documentation and the calculator above are free to use either way. Sign in to see it.