NAP
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Date Class Referencefinal

#include <nap/datetime.h>

Public Member Functions

 Date ()=default
 
 Date (int year, EMonth month, int day)
 
 Date (const SystemTimeStamp &systemTime)
 
void fromSystemTime (const SystemTimeStamp &systemTime)
 
SystemTimeStamp toSystemTime () const
 
bool valid () const
 

Static Public Member Functions

static bool exists (int year, EMonth month, int day)
 

Public Attributes

EMonth mMonth = EMonth::Unknown
 Property: 'Month' the month of the year. More...
 
int mDay = 1
 Property: 'Day' the day of the month (1-31) More...
 
int mYear = 1970
 Property: 'Year' the year. More...
 

Description

Serializable date structure that can be converted into a system time stamp. Use this when serialization / de-serialization of a date is required. This is a relatively light weight object that can be both copy and move constructed or assigned.

Constructor & Destructor Documentation

◆ Date() [1/3]

Date ( )
default

Default constructor

◆ Date() [2/3]

Date ( int  year,
EMonth  month,
int  day 
)

Constructs a date based on year, month and day

◆ Date() [3/3]

Date ( const SystemTimeStamp systemTime)

Constructor based on given system time. Extracts the date from the time stamp.

Parameters
systemTimethe time stamp to extract the date from.

Member Function Documentation

◆ exists()

static bool exists ( int  year,
EMonth  month,
int  day 
)
static

Helper function to check if a specific date exists. Gregorian dates started in 1582.

Parameters
yearthe year
monththe month
daythe day in the month

◆ fromSystemTime()

void fromSystemTime ( const SystemTimeStamp systemTime)

Extracts a date from a system time stamp

Parameters
systemTimethe time stamp to extract the date from

◆ toSystemTime()

SystemTimeStamp toSystemTime ( ) const

Converts a system time stamp into a date

◆ valid()

bool valid ( ) const

Helper function to check if the date exists.

Returns
if date exists

Member Data Documentation

◆ mDay

int mDay = 1

Property: 'Day' the day of the month (1-31)

◆ mMonth

Property: 'Month' the month of the year.

◆ mYear

int mYear = 1970

Property: 'Year' the year.