CodeCogs - An iteractive open source Numerical library Welcome... Login
CodeCogs
shopping cart
OSXWindowsLinux
Search CodeCogs
Numerical Components

Valid RSS

UnitsDate

next Week Day

Available under GPL (Free) and Commercial licence
get a GPL licence
COST (GBP)
this unit 1.50
sub units 2.34
add a commercial licence to your cart
0
viewed 1738 times and licensed 17 times

Advances the specified date to the next weekday.

Further Info Controller: CodeCogs  Contact Controller
+View version details
Contents hide toc
buy now     get GPL     add to cart

Interface

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

using namespace Units::Date;

int nextWeekDay (int nDate, bool forward=true)[inline]
Advances the specified date to the next weekday.

Function Documentation

Next Week Day Calculator
  
Add calculator to website or email
 
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 ...) , 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:

To view or download source code you need either a GPL or Commercial Licence.

buy now     get GPL     add to cart

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


Page Comments

Format Excel Equations

  You must login to leave a messge


Last Modified: 18 Feb 09 @ 10:56     Page Rendered: 2010-03-11 14:23:58

Valid CSS!   Valid XHTML 1.0 Transitional