I have forgotten

• https://me.yahoo.com
COST (GBP)
1.17
1.87
0

# year

viewed 2127 times and licensed 41 times
Extracts the year from a serial Julian date. Excel: MONTH
Controller: CodeCogs
Contents

C++

## Year

 intyear( int nDate calendar dateSystem )[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;
}

• cal_Gregorian - n.b. there is an optimised year function for Gregorian dates.
• cal_Julian - the only sensible mode (for the time being!!)
• cal_Excel (same as Gregorian)

### Note

It may be faster to simply use dateYMD, particularly if you also need the day and year from a date.

### 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. dateSystem selects which date system should be used (see constants):

### Authors

Will Bateman (Sep 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.

## Year

 intyear( int nDate )[inline]
Returns as an integer the Gregorian year for the serial Julian date, nDate. This function performs the following calculation:
$a&space;=&space;JulianDate&space;+&space;32103$
$b&space;=&space;\frac{a}{146097}$
$c&space;=&space;a\&space;mod\&space;146097$
$d&space;=&space;\frac{c}{36525}$
$e&space;=&space;c\&space;mod\&space;36525&space;+&space;d$
$Year&space;=&space;400&space;\frac{a}{146097}&space;+&space;100&space;d&space;+&space;4&space;\frac{e}{1461}&space;+&space;\frac{e\&space;mod\&space;1461}{365}&space;-&space;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

 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.

### Authors

Will Bateman (Sep 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.