Extracts the month from a serial Julian date. <span align="right" style="background-color:99FF99"><strong>Excel: MONTH</strong></span>

View versions (1)

Interface

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

using namespace Units::Date;

Returns the month of the year contained within a serial Julian date as an integer ranging from 1 to 12 (inclusive). This function uses dateYMD, to convert the serial Date into a day/ month/ year, from which the month is returned.

Example 1

#include <stdio.h>
#include <codecogs/units/date/month.h>
using namespace Units::Date;

int main()
{
  printf("\n The month is %d", month(1741664));               // The month is 5
  printf("\n The month is %d", month(1741664, cal_Julian));   // The month is 6
  return 0;
}

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):
Blank
  • cal_Gregorian (default)
  • cal_Julian
  • cal_Excel (same as Gregorian)

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

GPL Licence — free for non commercial use. See Licence details.