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 1.50
sub units 2.81
+
0
UnitsDate

next Week Day

Advances the specified date to the next weekday.
Controller: CodeCogs

get GPL add to cart

Dependents

Info

Interface

C++
HTML

NextWeekDay

 
intnextWeekDayintnDate
boolforward = true )[inline]
This function advances the provided date to the next weekday, ensuring that it lies between Monday and Friday.

Example 1

To compute the Christmas and New Year holidays:
#include <stdio.h>
#include <codecogs/units/date/nextweekday.h>
#include <codecogs/units/date/date.h>
 
using namespace Units::Date;
 
int main()
{
  int holidays[4];
  holidays[0] = date("24 dec 2005");                             // If your lucky!
  holidays[1] = nextWeekDay(date("25 dec 2005")-1);  // Christmas or if a weekend the next Monday.
  holidays[2] = nextWeekDay(holidays[1]);                   // next weekday after Christmas (Boxing
day).
  holidays[3] = nextWeekDay(date("1 jan 2006")-1);     // New year.
  return 0;
}
Remember that nextWeekDay automatically increments the date, so even if the give date is already a weekday it still advances - we therefore fool nextWeekDay by putting -1 after date , so it gives us the specified date or if a weekend the next weekday.

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.
forwardis a boolean that controls which direction the next week day is found in:
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.