Example of using date_time functions for generating calendar for current year.
#include <boost/locale.hpp>
#include <ctime>
#include <iomanip>
#include <iostream>
int main()
{
std::locale::global(gen(""));
std::cout.imbue(std::locale());
std::cout <<
format(
"{1,ftime='%Y'}") % now << std::endl;
std::cout <<
format(
"{1,ftime='%B'}") % now << std::endl;
else
std::cout <<
format(
"{1,ftime='%B'} ({1,ftime='%Y-%m-%d',locale=en} - {2,locale=en,ftime='%Y-%m-%d'})")
<< std::endl;
for(int i = 0; i < 7; i++) {
std::cout <<
format(
"{1,w=8,ftime='%a'} ") % tmp;
}
std::cout << std::endl;
for(int i = 0; i < skip * 9; i++)
std::cout << ' ';
std::cout <<
format(
"{1,w=8,ftime='%e'} ") % now;
std::cout << std::endl;
}
std::cout << std::endl;
}
}
this class provides an access to general calendar information.
Definition date_time.hpp:466
int first_day_of_week() const
Get first day of week for specific calendar, for example for US it is 1 - Sunday for France it is 2 -...
this class represents a date time and allows to perform various operation according to the locale set...
Definition date_time.hpp:558
void set(period::period_type f, int v)
set specific period f value to v
int minimum(period::period_type f) const
Get minimal possible value for *this time point for a period f.
int maximum(period::period_type f) const
the major class used for locale generation
Definition generator.hpp:101
period_type day_of_week_local()
Get period_type for: Local day of week, for example in France Monday is 1, in US Sunday is 1,...
Definition date_time.hpp:108
period_type day()
Get period_type for: The day of month, calendar specific, in Gregorian [1..31].
Definition date_time.hpp:82
period_type year()
Get period_type for: Year, it is calendar specific, for example 2011 in Gregorian calendar.
Definition date_time.hpp:67
period_type month()
Get period_type for: The month of year, calendar specific, in Gregorian [0..11].
Definition date_time.hpp:77
period_type day_of_week()
Definition date_time.hpp:97
This is the main namespace that encloses all localization classes.
Definition boundary_point.hpp:13