95 Set( timeStamp, timezone );
109 int hour= 0,
int minute= 0,
int second= 0,
int millisecond= 0 )
293 return DateTime::Duration::FromNanoseconds(
ToNanoSeconds() );
397 Set( year, month, day, dayOfWeek );
418 ,calendarDateTime.
Month
419 ,calendarDateTime.
Day
430 Set( dateTime, timezone);
447 void Set(
int year,
int month,
int day,
int dayOfWeek= -1);
476 int hour= 12,
int minute= 0,
int second= 0 )
const;
496 int Day()
const {
return int( (
stamp >> 3) & 31 ); }
521 return (*
this) + (-daysToSubtract);
567 return (*
this)= (*this) + daysToAdd;
577 return (*
this)+= (- daysToSubtract);
int Minute
The calendar minute (0..59).
ALIB_DLL void Set(const DateTime &timeStamp, lang::Timezone timezone=lang::Timezone::Local)
int Second
The calendar second (0..59).
CalendarDateTime(const DateTime &timeStamp, lang::Timezone timezone=lang::Timezone::Local)
int Day
The calendar day (1..31).
CalendarDateTime(lang::Initialization init=lang::Initialization::Default)
ALIB_DLL AString & Format(Substring format, AString &target, lang::CurrentData targetData=lang::CurrentData::Keep) const
int Hour
The calendar hour (0..23).
static ALIB_DLL String MONTH_NAMES[12]
int Year
The calendar year (e.g., 2022).
CalendarDateTime(int year, int month=1, int day=1, int hour=0, int minute=0, int second=0, int millisecond=0)
ALIB_DLL DateTime Get(lang::Timezone timezone=lang::Timezone::Local) const
ALIB_DLL void Clear()
Sets all public values to 0.
static ALIB_DLL String DAY_NAMES[7]
int Month
The calendar month (1..12).
int Millisecond
The calendar millisecond (0..999).
bool operator>(const CalendarDate &other) const
CalendarDate()=default
Default constructor leaving this object uninitialized (random value). **************.
ALIB_DLL void Set(int year, int month, int day, int dayOfWeek=-1)
bool operator==(const CalendarDate &other) const
CalendarDate operator--(int)
ALIB_DLL CalendarDateTime ToCalendarDateTime() const
ALIB_DLL CalendarDate operator++()
CalendarDate operator-(int daysToSubtract) const
CalendarDate(const DateTime &dateTime, lang::Timezone timezone)
bool operator!=(const CalendarDate &other) const
uint32_t stamp
Encoded date value.
ALIB_DLL CalendarDate(const CalendarDateTime &calendarDateTime)
CalendarDate(const CalendarDate &) noexcept=default
Trivial default copy constructor. ***************************************************.
CalendarDate operator+=(int daysToAdd)
CalendarDate operator-=(int daysToSubtract)
CalendarDate(CalendarDate &&) noexcept=default
Trivial default move constructor. ***************************************************.
ALIB_DLL DateTime Get(lang::Timezone timezone=lang::Timezone::Local, int hour=12, int minute=0, int second=0) const
bool operator<=(const CalendarDate &other) const
CalendarDate operator++(int)
bool operator>=(const CalendarDate &other) const
CalendarDate(lang::Timezone timezone)
ALIB_DLL CalendarDate operator+(int daysToAdd) const
bool operator<(const CalendarDate &other) const
ALIB_DLL CalendarDate operator--()
CalendarDuration(lang::Initialization init=lang::Initialization::Default)
CalendarDuration(DateTime::Duration duration)
int Seconds
The number of seconds (not the total, hence 0-59) within the duration.
CalendarDuration(Ticks::Duration duration)
ALIB_DLL void FromNanoSeconds(int64_t nanos)
Ticks::Duration ToTicksDuration()
int Hours
The number of hours (not the total, hence 0-23) within the duration.
int Nanoseconds
The number of nanoseconds (not the total, hence 0-999) within the duration.
CalendarDuration(int64_t nanos)
int Minutes
The number of minutes (not the total, hence 0-59) within the duration.
void FromDuration(DateTime::Duration duration)
int Milliseconds
The number of milliseconds (not the total, hence 0-999) within the duration.
ALIB_DLL void Clear()
Sets all public values to 0.
DateTime::Duration ToDateTimeDuration()
void FromDuration(Ticks::Duration duration)
int Microseconds
The number of microseconds (not the total, hence 0-999) within the duration.
int Days
The number of days within the duration.
ALIB_DLL int64_t ToNanoSeconds()
@ Keep
Chooses not no clear existing data.
Initialization
Used for example with constructors that allow to suppress initialization of members.
Timezone
Denotes whether a time value represents local time or UTC.
@ Local
Denotes local time.
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
time::DateTime DateTime
Type alias in namespace alib.
strings::util::CalendarDateTime CalendarDateTime
Type alias in namespace alib.
strings::util::CalendarDuration CalendarDuration
Type alias in namespace alib.
strings::util::CalendarDate CalendarDate
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
strings::TSubstring< character > Substring
Type alias in namespace alib.