Skip to content

calendar.h ~ calendar ~ month_type

Baptiste Thémine edited this page Jul 9, 2020 · 10 revisions
namespace calendar::month { typedef /* implementation defined */ month_type; }

Description

Defines integer type to store the representation of months in a year.

An ISO 8601 valid month_type must have a value between 1 and 12, in which case it can be safely handled as a month parameter such as in datetime_type or class Date constructor, otherwise the program is ill-formed.

Member functions

Name Description
operator>>
operator<<
I/O stream operators for calendar types.

Examples

In the following example, we create a valid date with the month specified by user input.

#include <iostream>
#include <JLC/JLC.h>
using namespace JLC;
using namespace calendar::month;

int main(){
    month_type month;
    do{
        std::cout << "month = ";
        std::cin >> month;
    }while(!debug::verify(std::cin));
    std::cout << Date(1,month) << std::endl;
}
>./test.exe
month = test
month = 0
month = 2
0001-02-01T00:00:00+0000

>./test.exe
month = february
0001-02-01T00:00:00+0000
Clone this wiki locally