lecui 1.0.0-alpha.20
lecui C++ user interface library
Static Public Member Functions | List of all members
liblec::lecui::date_time Class Reference

Interact with date/time. More...

#include <date_time.h>

Static Public Member Functions

static std::string time_stamp ()
 Make timestamp from current local time in the form 20190802 20:48:06.
 
static std::string weekday_to_string (unsigned short d)
 Get week day in the form of a string. More...
 
static std::string month_to_string (unsigned short m)
 Get month in the form of a string. More...
 
static unsigned short month_from_string (std::string m)
 Get month from string. More...
 
static std::string to_string (date dt)
 Get date in the form of a string. More...
 
static date from_string (const std::string &dt)
 Parse date from a date string. More...
 
static date today ()
 Get the current local date. More...
 
static date last_day_of_month (const date &dt)
 Get the last day of the month for a given date. More...
 
static unsigned short day_of_week (date dt)
 Get the day of the week for a given date. More...
 
static date add_days (date dt, int n)
 Add days to a given date. More...
 
static void get_week (const date dt, date &start, date &end)
 Get the start and end days of the week for a given date. More...
 
static void get_month (const date dt, date &start, date &end)
 Get the start and end days of the month for a given date. More...
 
static void get_year (const date dt, date &start, date &end)
 Get the start and end days of the year for a given date. More...
 

Detailed Description

Interact with date/time.

Member Function Documentation

◆ add_days()

static date liblec::lecui::date_time::add_days ( date  dt,
int  n 
)
static

Add days to a given date.

Parameters
dtThe date.
nThe number of days to add.
Returns
A date that is n days away from the given date.

◆ day_of_week()

static unsigned short liblec::lecui::date_time::day_of_week ( date  dt)
static

Get the day of the week for a given date.

Parameters
dtThe date.
Returns
The day of the week, from 1 to 7 inclusive (with Sunday as 1).

◆ from_string()

static date liblec::lecui::date_time::from_string ( const std::string &  dt)
static

Parse date from a date string.

Parameters
dtThe date string.
Returns
The date.

◆ get_month()

static void liblec::lecui::date_time::get_month ( const date  dt,
date start,
date end 
)
static

Get the start and end days of the month for a given date.

Parameters
dtThe date.
startThe month's start day.
endThe month's end day.

◆ get_week()

static void liblec::lecui::date_time::get_week ( const date  dt,
date start,
date end 
)
static

Get the start and end days of the week for a given date.

Parameters
dtThe date.
startThe week's start day (Sunday).
endThe week's end day (Saturday).

◆ get_year()

static void liblec::lecui::date_time::get_year ( const date  dt,
date start,
date end 
)
static

Get the start and end days of the year for a given date.

Parameters
dtThe date.
startThe year's start day.
endThe year's end day.

◆ last_day_of_month()

static date liblec::lecui::date_time::last_day_of_month ( const date dt)
static

Get the last day of the month for a given date.

Parameters
dtThe date.
Returns
The last day of the month.

◆ month_from_string()

static unsigned short liblec::lecui::date_time::month_from_string ( std::string  m)
static

Get month from string.

Parameters
mThe month string, in the form "Jan".
Returns
Returns the month as a number from 1 to 12 inclusive.

◆ month_to_string()

static std::string liblec::lecui::date_time::month_to_string ( unsigned short  m)
static

Get month in the form of a string.

Parameters
mThe month number, from 1 to 12 inclusive.
Returns
Returns the month in the form "Jan".

◆ to_string()

static std::string liblec::lecui::date_time::to_string ( date  dt)
static

Get date in the form of a string.

Parameters
dtThe date.
Returns
The date in the form "01-Jan-2020".

◆ today()

static date liblec::lecui::date_time::today ( )
static

Get the current local date.

Returns
The local date.

◆ weekday_to_string()

static std::string liblec::lecui::date_time::weekday_to_string ( unsigned short  d)
static

Get week day in the form of a string.

Parameters
dThe day of the week, 1 to 7 inclusive.
Returns
The week day in the form "Tuesday".

The documentation for this class was generated from the following file: