CodeCogs - A iteractive open source Numerical library in C/C++, with wrappers for .NET and Excel Welcome... Login
Site Map
shopping cart
OSXWindowsLinux
Search CodeCogs
Numerical Components
References

Valid RSS

unitsdate

year

Available under GPL (Free) and Commercial licence
get a GPL licence
COST (GBP)
this unit 0.98
sub units 1.56
add a commercial licence to your cart
0
viewed 2061 times and licensed 26 times

Extracts the year from a serial Julian date. Excel: MONTH

Other modules that are used by this module. We add these to the cart for you whenever you add this module, unless you already own enough licences for them. Click for details
Controller: CodeCogs    Contact Controller

+View version details
Contents hide toc
buy now     get GPL     add to cart

Interface

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

using namespace Units::Date;

int year (int nDate, calendar dateSystem)[inline]
Extracts the year from a serial Julian date Excel: MONTH
int year (int nDate)[inline]
Extracts the Gregorian year from a serial Julian date Excel: YEAR

Function Documentation

 
intyearintnDate
calendardateSystem )[inline]
Returns the year contained within a serial Julian date as an integer. This function uses dateYMD, to convert the serial Date into a day/ month/ year, from which the year is returned.
Example 1:
#include <stdio.h>
#include <codecogs/units/date/year.h>
using namespace Units::Date;
 
int main()
{
  printf("\n The year is %d", year(1741667));               // The year is 0056
  printf("\n The year is %d", year(1841667, cal_Julian));   // The year is 0330
  return 0;
}

Note:
It may be faster to simply use dateYMD, particularly if you also need the day and year from a date.
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.
dateSystemselects which date system should be used (see constants):
Authors:
Will Bateman (Sep 2004)
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.

Year Calculator
  
Add calculator to website or email
 
intyearintnDate )[inline]
Returns as an integer the Gregorian year for the serial Julian date, nDate. This function performs the following calculation:
\displaystyle  a = JulianDate + 32103
\displaystyle  b = \frac{a}{146097}
\displaystyle  c = a\ mod\ 146097
\displaystyle  d = \frac{c}{36525}
\displaystyle  e = c\ mod\ 36525 + d
\displaystyle  Year = 400 \frac{a}{146097} + 100 d + 4 \frac{e}{1461} + \frac{e\ mod\ 1461}{365} - 4800
where all division are integer divisions with the remainder discarded.

References:

www.ortelius.de/kalender/calc_en.php
Example 2:
#include <stdio.h>
#include <codecogs/units/date/year.h>
using namespace Units::Date;
 
void main()
{
  printf("\n The year is %d", year(27325));          // The year is 1974
  printf("\n The year is %d", year(169304));         // The year is 2367
}
Note:
If you require the day, month and year from the Julian Date it may be faster to simply use dateYMD, particularly if you need two or more parts of a date.
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.
Authors:
Will Bateman (Sep 2004)
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: 25 Oct 08 @ 09:56     Page Rendered: 2009-07-01 11:23:34

Valid CSS!   Valid XHTML 1.0 Transitional