  | 
  
    Qore Programming Language
    0.9.16
    
   | 
 
 
 
 
   32 #ifndef QORE_DATETIME_H 
   34 #define QORE_DATETIME_H 
   38 class AbstractQoreZoneInfo;
 
   42    int year, month, day, hour, minute, second, us, utc_secs_east;
 
   44    const char* zone_name;
 
   45    const AbstractQoreZoneInfo* zone;
 
   47    DLLLOCAL 
void clear() {
 
   61    DLLLOCAL 
bool isTimeNull()
 const {
 
   62       return !hour && !minute && !second && !us;
 
   95    friend class qore_relative_time;
 
   96    friend class qore_absolute_time;
 
  102    DLLLOCAL 
void setDateLiteral(
int64 date);
 
  103    DLLLOCAL 
void setRelativeDateLiteral(
int64 date);
 
  109    DLLLOCAL 
DateTime(qore_date_private *n_priv);
 
  129    DLLEXPORT 
DateTime(
int n_year, 
int n_month, 
int n_day, 
int n_hour = 0, 
int n_minute = 0, 
int n_second = 0, 
short n_ms = 0, 
bool n_relative = 
false);
 
  151    DLLEXPORT 
explicit DateTime(
const AbstractQoreZoneInfo* zone, 
const QoreValue v);
 
  162    DLLEXPORT 
DateTime(
const char* date);
 
  176    DLLEXPORT 
DateTime(
const AbstractQoreZoneInfo* zone, 
const char* date);
 
  182    DLLEXPORT 
DateTime(
const struct tm *tms);
 
  191    DLLEXPORT 
void getTM(
struct tm *tms) 
const;
 
  202    DLLEXPORT 
void setNow(
const AbstractQoreZoneInfo* zone);
 
  222    DLLEXPORT 
void setDate(
const AbstractQoreZoneInfo* zone, 
int64 seconds, 
int us);
 
  229    DLLEXPORT 
void setLocalDate(
const AbstractQoreZoneInfo* zone, 
int64 seconds, 
int us);
 
  232    DLLEXPORT 
void setDate(
const AbstractQoreZoneInfo* n_zone, 
int n_year, 
int n_month, 
int n_day, 
int n_hour = 0, 
int n_minute = 0, 
int n_second = 0, 
int n_us = 0);
 
  238    DLLEXPORT 
void setDate(
const char* str);
 
  254    DLLEXPORT 
void setDate(
const AbstractQoreZoneInfo* zone, 
const char* str);
 
  260    DLLEXPORT 
void setDate(
const struct tm *tms, 
short ms = 0);
 
  272    DLLEXPORT 
void setTime(
int h, 
int m, 
int s, 
short ms = 0);
 
  277    DLLEXPORT 
bool checkValidity() 
const;
 
  278    DLLEXPORT 
bool isEqual(
const DateTime* dt) 
const;
 
  279    DLLEXPORT 
bool isEqual(
const DateTime& dt) 
const;
 
  337    DLLEXPORT 
void getISOWeek(
int& year, 
int& week, 
int& day) 
const;
 
  397    DLLEXPORT 
short getYear() 
const;
 
  409    DLLEXPORT 
int getDay() 
const;
 
  474    DLLEXPORT 
void getInfo(
const AbstractQoreZoneInfo* n_zone, 
qore_tm &info) 
const;
 
  480    DLLEXPORT 
void setZone(
const AbstractQoreZoneInfo* n_zone);
 
  483    DLLEXPORT 
const AbstractQoreZoneInfo* 
getZone() 
const;
 
  507    DLLEXPORT 
static DateTime* 
makeAbsolute(
const AbstractQoreZoneInfo* n_zone, 
int n_year, 
int n_month, 
int n_day, 
int n_hour = 0, 
int n_minute = 0, 
int n_second = 0, 
int n_us = 0);
 
  526    DLLEXPORT 
static DateTime* 
makeRelative(
int n_year, 
int n_month, 
int n_day, 
int n_hour = 0, 
int n_minute = 0, 
int n_second = 0, 
int n_us = 0);
 
  
 
DLLEXPORT DateTime * unaryMinus() const
returns the negative time from the current time
 
static DLLEXPORT DateTime * getDateFromISOWeek(int year, int week, int day, ExceptionSink *xsink)
returns a DateTime value from ISO-8601 week and day offsets
 
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:262
 
static DLLEXPORT DateTime * makeAbsoluteLocal(const AbstractQoreZoneInfo *zone, int64 seconds, int us=0)
static "constructor" to create an absolute time as an offset from the given time zone's epoch,...
 
DLLEXPORT int getDayOfWeek() const
returns the day of week for the current date (0-6, Sun-Sat)
 
static DLLEXPORT int compareDates(const DateTime *left, const DateTime *right)
returns -1, 0, or 1 if the left date is less than, equal, or greater than the right date
 
DLLEXPORT int secsEast() const
returns seconds east of UTC for zone
 
DLLEXPORT void getTM(hashdecl tm *tms) const
sets a "hashdecl tm" from the current date/time value for the time zone for the object; use DateTime::g...
 
DLLEXPORT bool isAbsolute() const
returns true if the value is an absolute date-time value
 
DLLEXPORT int64 getEpochMicrosecondsUTC() const
gets the number of microseconds since January 1, 1970Z for the current date
 
DLLEXPORT void addSecondsTo(int64 secs, int us=0)
adds the given number of seconds (and microseconds) to the date/time value
 
const DLLEXPORT AbstractQoreZoneInfo * getZone() const
gets the time zone for the object; returns 0 for relative date/time values
 
DLLEXPORT int getMonth() const
returns the month portion of the date-time value (in local time according to the time zone for absolu...
 
DLLEXPORT int64 getEpochSecondsUTC() const
gets the number of seconds since January 1, 1970Z for the current date
 
static DLLEXPORT int getLastDayOfMonth(int month, int year)
returns the number of days in the month given according to a proleptic gregorian calendar
 
DLLEXPORT int getDay() const
returns the day portion of the date-time value (in local time according to the time zone for absolute...
 
static DLLEXPORT DateTime * makeRelative(int n_year, int n_month, int n_day, int n_hour=0, int n_minute=0, int n_second=0, int n_us=0)
static "constructor" to create a relative time, including microseconds
 
DLLEXPORT int64 getRelativeMilliseconds() const
returns the difference as the number of milliseconds between the date/time value and the local time a...
 
DLLLOCAL DateTime(qore_date_private *n_priv)
this constructor is not exported in the library
 
DLLEXPORT void getISOWeek(int &year, int &week, int &day) const
returns the ISO-8601 week information
 
static DLLEXPORT DateTime * makeAbsolute(const AbstractQoreZoneInfo *n_zone, int n_year, int n_month, int n_day, int n_hour=0, int n_minute=0, int n_second=0, int n_us=0)
static "constructor" to create an absolute time, including microseconds
 
static DLLEXPORT DateTime * makeRelativeFromSeconds(int64 n_second, int n_us=0)
static "constructor" to create a relative time, including microseconds
 
long long int64
64bit integer type, cannot use int64_t here since it breaks the API on some 64-bit systems due to equ...
Definition: common.h:260
 
DLLEXPORT bool isRelative() const
returns true if the value is a relative date-time value
 
DLLLOCAL DateTime & operator=(const DateTime &)
this function is not implemented; it is here as a private function in order to prohibit it from being...
 
DLLEXPORT void unaryMinusInPlace()
converts the current value to the negative of itself
 
DLLEXPORT int getSecond() const
returns the second portion of the date-time value (in local time according to the time zone for absol...
 
const DLLEXPORT char * regionName() const
returns the region name of the zone
 
DLLEXPORT int getMicrosecond() const
returns the microsecond portion of the date-time value
 
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:81
 
Qore's parse tree/value type for date-time values, reference-counted, dynamically-allocated only.
Definition: DateTimeNode.h:45
 
DLLEXPORT int64 getRelativeSeconds() const
returns the difference as the number of seconds between the date/time value and the local time at the...
 
DLLEXPORT int getMinute() const
returns the minute portion of the date-time value (in local time according to the time zone for absol...
 
DLLEXPORT int getMillisecond() const
returns the microsecond portion of the date-time value divided by 1000
 
static DLLEXPORT bool isLeapYear(int year)
returns true if the year passed is a leap year according to a proleptic gregorian calendar
 
DLLEXPORT void setTime(int h, int m, int s, short ms=0)
sets the time from hours, minutes, seconds, and milliseconds
 
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
 
DLLEXPORT void setLocalDate(const AbstractQoreZoneInfo *zone, int64 seconds, int us)
sets the absolute date value based on the number of seconds from January 1, 1970 in the given time zo...
 
DLLEXPORT int getHour() const
returns the hour portion of the date-time value (in local time according to the time zone for absolut...
 
DLLEXPORT short getYear() const
returns the year portion of the date-time value (in local time according to the time zone for absolut...
 
DLLEXPORT int64 getEpochMillisecondsUTC() const
gets the number of milliseconds since January 1, 1970Z for the current date
 
DLLEXPORT void setRelativeDate(const char *str)
sets a relative date from a string in the format YYYYMMDDHHmmSS
 
class qore_date_private * priv
private date data - most are ints so relative dates can hold a lot of data
Definition: DateTime.h:100
 
DLLEXPORT void setRelativeDateSeconds(int64 s, int us=0)
set the object to a relative date/time value as given in seconds and optionally microseconds
 
Holds absolute and relative date/time values in Qore with precision to the microsecond.
Definition: DateTime.h:93
 
DLLEXPORT ~DateTime()
destroys the object and frees all memory
 
DLLEXPORT int64 getEpochSeconds() const
gets the number of seconds since January 1, 1970 for the current date offset in local time
 
DLLEXPORT void format(QoreString &str, const char *fmt) const
formats the date/time value to a QoreString
 
DLLEXPORT int getDayNumber() const
returns the ordinal number of the day in the year for absolute dates, sometimes (mistakenly) referred...
 
DLLEXPORT void setDate(int64 seconds)
sets the absolute date value based on the number of seconds from January 1, 1970
 
DLLEXPORT double getRelativeSecondsDouble() const
returns the difference as the number of seconds between the date/time value and the local time at the...
 
for returning broken-down time information
Definition: DateTime.h:41
 
DLLEXPORT bool hasValue() const
returns true if the object has a value, false if not (zero value = 1970-01-01Z for absolute times,...
 
DLLEXPORT int64 getRelativeMicroseconds() const
returns the difference as the number of microseconds between the date/time value and the local time a...
 
DLLEXPORT void getInfo(const AbstractQoreZoneInfo *n_zone, qore_tm &info) const
returns the broken-down time in the given time zone (n_zone = 0 means UTC)
 
DLLEXPORT void setNow()
sets the current date and time in the current time zone; current contents are overwritten
 
DLLEXPORT void setZone(const AbstractQoreZoneInfo *n_zone)
changes the time zone for the time without updating the epoch offset