I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
COST (GBP)
this unit 2.81
sub units 0.00
+
0
UnitsDate

day Of Week

viewed 3549 times and licensed 121 times
Computes the day of the week (Sunday through to Monday), for the specified serial Julian date.
Controller: CodeCogs

get GPL add to cart

Interface

C++
Excel

DayOfWeek

 
intdayOfWeekintnDate
inttype = 1 )[inline]
Calculates the week day from a serial Julian date. This is correct for both the Gregorian and Julian calendar. The solution is merely:

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;
}

  • 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).

Parameters

nDateis a serial number of days from 24 November 4714 BC (1 January 4713BC in the Julian Calendar) - also known as the Julian Period.
typedefines the output style for the day of the week

Authors

Will Bateman (Oct 2004)
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.