I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
this unit 2.81
sub units 0.00

day Of Year

viewed 2964 times and licensed 79 times
Computes the Gregorian day of the year from a serial Julian date.
Controller: CodeCogs

get GPL add to cart




intdayOfYearintnDate )[inline]
This function calculates the day of the year from a serial date, such that 1st January = 1 and 31st December = 365 or 366 in a leap year. The Gregorian calendar is assumed for these calculations. The most general solution for our Julian mode is: where nDate is equal to the Julian Period, and all division are integer divisions.

Example 1

#include <stdio.h>
#include <codecogs/units/date/dayofyear.h>
#include <codecogs/units/date/date.h>
using namespace Units::Date;
int main()
  for(int i=5;i<15;i++)
    int adate=date(2004, 2, i);
    printf("\n %d February 2004 is %d day of year", i, dayOfYear(adate));
  return 0;


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


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.