Returns a string pointer to the month of the year.

You're viewing an older version of this page (#201). View the current version.

View versions (1)

Interface

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

using namespace Units::Date;

Returns a string pointer to a description of the month specified, i.e. 1="January", 2=February, 3="March"

Example 1

The months of the year are therefore:

#include <stdio.h>
#include <codecogs/units/date/month_str.h>
#include <codecogs/units/date/constants.h>

using namespace Units::Date;

int main()
{
  for(int i=January;i<=December;i++)
    printf("\n Month number [%d] is %s ", i, month_str(i));
  return 0;
}

Output:

Month number [1] is January
Month number [2] is February
Month number [3] is March
Month number [4] is April
Month number [5] is May
Month number [6] is June
Month number [7] is July
Month number [8] is August
Month number [9] is September
Month number [10] is October
Month number [11] is November
Month number [12] is December

Parameters

nMonth
is the numeric value of the month in the range 1 to 12 (inclusive). Values outside this range are wrapped back into range. So nMonth=13 is the same as nMonth=1;
GPL Licence — free for non commercial use. See Licence details.