Jameo Core Library
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
jm::Date Class Reference

Date represents a date or time. More...

Inheritance diagram for jm::Date:
jm::Comparable< Date >

Public Member Functions

 Date ()
 Standard default constructor.
 
 Date (const Date &other)
 Copyconstruktor.
 
 Date (int64 milliseconds)
 Constructor.
 
 Date (uint16 year, uint16 month, uint16 day)
 Constructor.
 
 Date (uint16 year, uint16 month, uint16 day, uint16 hours, uint16 minutes, uint16 seconds, uint16 millis=0)
 Constructor.
 
 ~Date () override
 Destructor.
 
bool isEmpty () const
 Status, whether the data is empty.
 
int64 time () const
 Returns the time passed in milliseconds, relative to 00:00:00 UTC on 1 January 1970.
 
void setTime (int64 t)
 Defines the time passed in milliseconds, relative to 00:00:00 UTC on 1 January 1970.
 
int64 year () const
 Returns the year in local time.
 
int64 utcYear () const
 Returns the year in UTC time.
 
int64 month () const
 Returns the month in local time.
 
int64 utcMonth () const
 Returns the month in UTC time.
 
int64 date () const
 Returns the day of the month in local time.
 
int64 utcDate () const
 Returns the day of the month in UTC time.
 
int64 day () const
 Returns the day of the week in local time.
 
int64 utcDay () const
 Returns the day of the week in UTC time.
 
int64 hours () const
 Returns the hours of the day in local time.
 
int64 utcHours () const
 Returns the hours of the day in UTC time.
 
int64 minutes () const
 Returns the minutes of the hour in local time.
 
int64 utcMinutes () const
 Returns the minutes of the hour in UTC time.
 
int64 seconds () const
 Returns the seconds of the minute in local time.
 
int64 dayOfYear () const
 Returns the day of the year.
 
int64 utcSeconds () const
 Returns the seconds of the minute in UTC time.
 
int64 milliseconds () const
 Returns the milliseconds of the second in local time.
 
int64 utcMilliseconds () const
 Returns the milliseconds of the second in UTC time.
 
String toString () const
 Returns the date in the default date format: YYYY-MM-DDThh:mm:ss.sssZ.
 
int32 compareTo (const Date &another) const override
 This method compares the order of the data.
 
- Public Member Functions inherited from jm::Comparable< Date >
 Comparable ()
 
virtual ~Comparable ()
 

Static Public Member Functions

static Date fromNSDate (double nsdate)
 Constructor for a Date value given as a NSDate double value (typically on Mac)
 

Static Public Attributes

static const int64 MS_PER_DAY = 86400000
 Constant saves the millisecons of a day.
 
static const int64 HOURS_PER_DAY = 24
 
static const int64 MINUTES_PER_HOUR = 60
 
static const int64 SECONDS_PER_MINUTE = 60
 
static const int64 MS_PER_SECOND = 1000
 
static const int64 MS_PER_MINUTE = 60000
 
static const int64 MS_PER_HOUR = 3600000
 
static const int16 JANUARY = 0
 
static const int16 FEBRUARY = 1
 
static const int16 MARCH = 2
 
static const int16 APRIL = 3
 
static const int16 MAY = 4
 
static const int16 JUNE = 5
 
static const int16 JULY = 6
 
static const int16 AUGUST = 7
 
static const int16 SEPTEMBER = 8
 
static const int16 OCTOBER = 9
 
static const int16 NOVEMBER = 10
 
static const int16 DECEMBER = 11
 
static const int16 SUNDAY = 0
 
static const int16 MONDAY = 1
 
static const int16 TUESDAY = 2
 
static const int16 WEDNESDAY = 3
 
static const int16 THURSDAY = 4
 
static const int16 FRIDAY = 5
 
static const int16 SATURDAY = 6
 
static const int64 EMPTY = static_cast<int64>(0x8000000000000000)
 

Friends

DllExport friend bool operator< (Date const &v1, Date const &v2)
 Implementing the operator <.
 
DllExport friend bool operator> (Date const &v1, Date const &v2)
 Implementing the operator >
 
DllExport friend bool operator<= (Date const &v1, Date const &v2)
 Implementing the operator <=.
 
DllExport friend bool operator>= (Date const &v1, Date const &v2)
 Implementing the operator >=.
 
DllExport friend bool operator== (Date const &v1, Date const &v2)
 Implementing the operator ==.
 
DllExport friend bool operator!= (Date const &v1, Date const &v2)
 Implementing the operator !=.
 

Detailed Description

Date represents a date or time.

Internally, the time is stored in milliseconds from 01.01.1970 0:00 UTC. This time is referred to as absolute time in this context. Leap seconds are ignored.

The basis of this implementation is the Date object from the ECMA standard. The basis is the Gregorian calendar.

If the value is 0x800000000000 || -9223372036854775808 (minimum), then the date is considered "Empty" "Zero" "Nil"

Constructor & Destructor Documentation

◆ Date() [1/5]

jm::Date::Date ( )

Standard default constructor.

◆ Date() [2/5]

jm::Date::Date ( const Date other)

Copyconstruktor.

◆ Date() [3/5]

jm::Date::Date ( int64  milliseconds)
explicit

Constructor.

Parameters
millisecondsAbsolute time (UTC) passed in milliseconds since 01.01.1970 00:00:00.000.

◆ Date() [4/5]

jm::Date::Date ( uint16  year,
uint16  month,
uint16  day 
)

Constructor.

Parameters
yearYear
monthMonth number (0-11)
dayDay number (1-31)

◆ Date() [5/5]

jm::Date::Date ( uint16  year,
uint16  month,
uint16  day,
uint16  hours,
uint16  minutes,
uint16  seconds,
uint16  millis = 0 
)

Constructor.

Parameters
yearYear
monthMonth number (0-11)
dayDay number (1-31)
hoursHours (0-23)
minutesMinutes (0-59)
secondsSeconds (0-59)
millisMilliseconds (0-999)

◆ ~Date()

jm::Date::~Date ( )
override

Destructor.

Member Function Documentation

◆ compareTo()

int32 jm::Date::compareTo ( const Date another) const
overridevirtual

This method compares the order of the data.

Parameters
anotherThe date used for the comparison.

Implements jm::Comparable< Date >.

◆ date()

int64 jm::Date::date ( ) const

Returns the day of the month in local time.

◆ day()

int64 jm::Date::day ( ) const

Returns the day of the week in local time.

◆ dayOfYear()

int64 jm::Date::dayOfYear ( ) const

Returns the day of the year.

◆ fromNSDate()

static Date jm::Date::fromNSDate ( double  nsdate)
static

Constructor for a Date value given as a NSDate double value (typically on Mac)

Parameters
nsdatedouble value, representing the time in seconds relative to 00:00:00 UTC on 1 January 2001.

◆ hours()

int64 jm::Date::hours ( ) const

Returns the hours of the day in local time.

◆ isEmpty()

bool jm::Date::isEmpty ( ) const

Status, whether the data is empty.

◆ milliseconds()

int64 jm::Date::milliseconds ( ) const

Returns the milliseconds of the second in local time.

◆ minutes()

int64 jm::Date::minutes ( ) const

Returns the minutes of the hour in local time.

◆ month()

int64 jm::Date::month ( ) const

Returns the month in local time.

Note
The number ranges between 0 and 11

◆ seconds()

int64 jm::Date::seconds ( ) const

Returns the seconds of the minute in local time.

◆ setTime()

void jm::Date::setTime ( int64  t)

Defines the time passed in milliseconds, relative to 00:00:00 UTC on 1 January 1970.

Parameters
tNew time in UTC.

◆ time()

int64 jm::Date::time ( ) const

Returns the time passed in milliseconds, relative to 00:00:00 UTC on 1 January 1970.

◆ toString()

String jm::Date::toString ( ) const

Returns the date in the default date format: YYYY-MM-DDThh:mm:ss.sssZ.

◆ utcDate()

int64 jm::Date::utcDate ( ) const

Returns the day of the month in UTC time.

◆ utcDay()

int64 jm::Date::utcDay ( ) const

Returns the day of the week in UTC time.

◆ utcHours()

int64 jm::Date::utcHours ( ) const

Returns the hours of the day in UTC time.

◆ utcMilliseconds()

int64 jm::Date::utcMilliseconds ( ) const

Returns the milliseconds of the second in UTC time.

◆ utcMinutes()

int64 jm::Date::utcMinutes ( ) const

Returns the minutes of the hour in UTC time.

◆ utcMonth()

int64 jm::Date::utcMonth ( ) const

Returns the month in UTC time.

◆ utcSeconds()

int64 jm::Date::utcSeconds ( ) const

Returns the seconds of the minute in UTC time.

◆ utcYear()

int64 jm::Date::utcYear ( ) const

Returns the year in UTC time.

◆ year()

int64 jm::Date::year ( ) const

Returns the year in local time.

Friends And Related Symbol Documentation

◆ operator!=

DllExport friend bool operator!= ( Date const &  v1,
Date const &  v2 
)
friend

Implementing the operator !=.

◆ operator<

DllExport friend bool operator< ( Date const &  v1,
Date const &  v2 
)
friend

Implementing the operator <.

◆ operator<=

DllExport friend bool operator<= ( Date const &  v1,
Date const &  v2 
)
friend

Implementing the operator <=.

◆ operator==

DllExport friend bool operator== ( Date const &  v1,
Date const &  v2 
)
friend

Implementing the operator ==.

◆ operator>

DllExport friend bool operator> ( Date const &  v1,
Date const &  v2 
)
friend

Implementing the operator >

◆ operator>=

DllExport friend bool operator>= ( Date const &  v1,
Date const &  v2 
)
friend

Implementing the operator >=.

Member Data Documentation

◆ APRIL

const int16 jm::Date::APRIL = 3
static

◆ AUGUST

const int16 jm::Date::AUGUST = 7
static

◆ DECEMBER

const int16 jm::Date::DECEMBER = 11
static

◆ EMPTY

const int64 jm::Date::EMPTY = static_cast<int64>(0x8000000000000000)
static

◆ FEBRUARY

const int16 jm::Date::FEBRUARY = 1
static

◆ FRIDAY

const int16 jm::Date::FRIDAY = 5
static

◆ HOURS_PER_DAY

const int64 jm::Date::HOURS_PER_DAY = 24
static

◆ JANUARY

const int16 jm::Date::JANUARY = 0
static

◆ JULY

const int16 jm::Date::JULY = 6
static

◆ JUNE

const int16 jm::Date::JUNE = 5
static

◆ MARCH

const int16 jm::Date::MARCH = 2
static

◆ MAY

const int16 jm::Date::MAY = 4
static

◆ MINUTES_PER_HOUR

const int64 jm::Date::MINUTES_PER_HOUR = 60
static

◆ MONDAY

const int16 jm::Date::MONDAY = 1
static

◆ MS_PER_DAY

const int64 jm::Date::MS_PER_DAY = 86400000
static

Constant saves the millisecons of a day.

◆ MS_PER_HOUR

const int64 jm::Date::MS_PER_HOUR = 3600000
static

◆ MS_PER_MINUTE

const int64 jm::Date::MS_PER_MINUTE = 60000
static

◆ MS_PER_SECOND

const int64 jm::Date::MS_PER_SECOND = 1000
static

◆ NOVEMBER

const int16 jm::Date::NOVEMBER = 10
static

◆ OCTOBER

const int16 jm::Date::OCTOBER = 9
static

◆ SATURDAY

const int16 jm::Date::SATURDAY = 6
static

◆ SECONDS_PER_MINUTE

const int64 jm::Date::SECONDS_PER_MINUTE = 60
static

◆ SEPTEMBER

const int16 jm::Date::SEPTEMBER = 8
static

◆ SUNDAY

const int16 jm::Date::SUNDAY = 0
static

◆ THURSDAY

const int16 jm::Date::THURSDAY = 4
static

◆ TUESDAY

const int16 jm::Date::TUESDAY = 2
static

◆ WEDNESDAY

const int16 jm::Date::WEDNESDAY = 3
static