Skip to content

calendar.h ~ calendar ~ hour_type

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

Description

Defines integer type to store the representation of hours in a day.

An ISO 8601 valid hour_type must have a value between 0 and 23, in which case it can be safely handled as a hour 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 display today's time.

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

int main(){
    const Date today = Date::now();
    const hour_type hour = today.hour();
    const minute_type min = today.minute();
    std::cout << today << std::endl;
    std::cout << hour << "h" << min << std::endl;
}
2020-03-27T11:29:19+0000
11h29

See also

Clone this wiki locally