DateTimeNode Class Reference

Qore's parse tree/value type for date-time values, reference-counted, dynamically-allocated only. More...

`#include <DateTimeNode.h>`

Inheritance diagram for DateTimeNode:
[legend]
Collaboration diagram for DateTimeNode:
[legend]

## Public Member Functions

DLLEXPORT | DateTimeNode (bool r=false)
| constructor for an empty object More...
DLLEXPORT | DateTimeNode (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)
| constructor for setting all parameters More...
DLLEXPORT | DateTimeNode (int64 seconds)
| constructor for setting an absolute date based on the number of seconds from January 1, 1970 More...
DLLEXPORT | DateTimeNode (int64 seconds, int ms)
| constructor for setting an absolute date based on the number of seconds from January 1, 1970 (plus milliseconds) More...
DLLEXPORT | DateTimeNode (const AbstractQoreZoneInfo *zone, const QoreValue v)
| constructor for creating an absolute date from a value representing a number of seconds More...
DLLEXPORT | DateTimeNode (const QoreValue v)
| constructor for creating a relative date from a value representing a number of seconds More...
DLLEXPORT | DateTimeNode (const char *date)
| constructor for setting the date from a string with a flexible format, silently accepts invalid date strings More...
DLLEXPORT | DateTimeNode (const char *date, ExceptionSink *xsink)
| constructor for setting the date from a string with a flexible format, throws a Qore-language exception if the date string is invalid More...
DLLEXPORT | DateTimeNode (const AbstractQoreZoneInfo *zone, const char *date)
| constructor for setting the date from a string with a flexible format More...
DLLEXPORT | DateTimeNode (struct tm *tms)
| constructor for setting an absolute date based on a "struct tm" More...
DLLEXPORT | DateTimeNode (const DateTimeNode &dt)
| copy constructor
DLLEXPORT | DateTimeNode (const DateTime &dt)
| constructor to set the date from a DateTime value
DLLEXPORT DateTimeNode * | add (const DateTime *dt) const
| adds a DateTime value to the current value and returns the new value, the caller owns the pointer's reference count More...
DLLEXPORT DateTimeNode * | add (const DateTime &dt) const
| adds a DateTime value to the current value and returns the new value, the caller owns the pointer's reference count More...
DLLEXPORT DateTimeNode * | copy () const
| returns a copy of the DateTimeNode, the caller owns the pointer's reference count More...
virtual DLLEXPORT QoreString * | getAsString (bool &del, int foff, ExceptionSink *xsink) const
| returns the date/time value as a formatted string for n and N printf formatting, del is set to true More...
virtual DLLEXPORT int | getAsString (QoreString &str, int foff, ExceptionSink *xsink) const
| concatenates a string representation of the date/time value (designed for n and N printf formatting) to a QoreString reference More...
virtual DLLEXPORT DateTime * | getDateTimeRepresentation (bool &del) const
| returns "this" as a DateTime, del is set to false More...
virtual DLLEXPORT void | getDateTimeRepresentation (DateTime &dt) const
| assigns this date/time representation to the passed DateTime reference More...
virtual DLLEXPORT QoreString * | getStringRepresentation (bool &del) const
| returns a string in the format YYYYMMDDHHmmSS, del is set to true More...
virtual DLLEXPORT void | getStringRepresentation (QoreString &str) const
| concatentates the date/time value in the format YYYYMMDDHHmmDD to an existing QoreString reference More...
virtual DLLEXPORT const char * | getTypeName () const
| returns the type name as a c string
virtual DLLEXPORT bool | is_equal_hard (const AbstractQoreNode *v, ExceptionSink *xsink) const
| tests for equality ("deep compare" including all contained values for container types) without type conversions (hard compare) More...
virtual DLLEXPORT bool | is_equal_soft (const AbstractQoreNode *v, ExceptionSink *xsink) const
| tests for equality with possible type conversion (soft compare) More...
virtual DLLEXPORT int | parseInit (QoreValue &val, QoreParseContext &parse_context)
| returns the type information
virtual DLLEXPORT AbstractQoreNode * | realCopy () const
| returns a copy of the object; the caller owns the reference count More...
DLLEXPORT DateTimeNode * | refSelf () const
| returns this with an incremented ref count
DLLEXPORT DateTimeNode * | subtractBy (const DateTime *dt) const
| subtracts a DateTime value from the current value and returns the new value, the caller owns the pointer's reference count More...
DLLEXPORT DateTimeNode * | subtractBy (const DateTime &dt) const
| subtracts a DateTime value from the current value and returns the new value, the caller owns the pointer's reference count More...
DLLEXPORT DateTimeNode * | unaryMinus () const
| returns the negative time from the current time
Public Member Functions inherited from SimpleValueQoreNode
DLLLOCAL | SimpleValueQoreNode (qore_type_t t, bool n_there_can_be_only_one=false)
| creates the object by assigning the type code and setting the "value" flag, unsetting the "needs_eval" flag, and setting "there_can_be_only_one"
Public Member Functions inherited from SimpleQoreNode
DLLLOCAL | SimpleQoreNode (qore_type_t t, bool n_value, bool n_needs_eval, bool n_there_can_be_only_one=false)
| constructor takes the type and value arguments
DLLLOCAL | SimpleQoreNode (const SimpleQoreNode &v)
| copy constructor
DLLEXPORT void | deref (ExceptionSink *xsink)
| decrements the reference count and deletes the object when references = 0 More...
SimpleQoreNode & | operator= (const SimpleQoreNode &)=delete
| this function is not implemented
Public Member Functions inherited from AbstractQoreNode
DLLEXPORT | AbstractQoreNode (qore_type_t t, bool n_value, bool n_needs_eval, bool n_there_can_be_only_one=false, bool n_custom_reference_handlers=false)
| constructor takes the type More...
DLLEXPORT | AbstractQoreNode (const AbstractQoreNode &v)
| copy constructor
virtual DLLEXPORT void | customDeref (ExceptionSink *xsink)
virtual DLLEXPORT void | customRef () const
| special processing when the object's reference count transitions from 0-1 More...
DLLEXPORT void | deref (ExceptionSink *xsink)
| decrements the reference count and calls derefImpl() if there_can_be_only_one is false, otherwise does nothing More...
virtual DLLEXPORT bool | derefImpl (ExceptionSink *xsink)
| decrements the reference count More...
DLLEXPORT QoreValue | eval (ExceptionSink *xsink) const
| evaluates the object and returns a value (or 0) More...
DLLEXPORT QoreValue | eval (bool &needs_deref, ExceptionSink *xsink) const
| optionally evaluates the argument More...
DLLEXPORT int64 | getAsBigInt () const
| returns the 64-bit integer value of the object More...
DLLEXPORT bool | getAsBool () const
| returns the boolean value of the object More...
DLLEXPORT double | getAsFloat () const
| returns the float value of the object More...
DLLEXPORT int | getAsInt () const
| returns the integer value of the object More...
DLLLOCAL qore_type_t | getType () const
| returns the data type More...
DLLLOCAL bool | is_value () const
| returns true if the node represents a value More...
DLLLOCAL bool | isReferenceCounted () const
| returns true if the object is reference-counted
DLLLOCAL bool | needs_eval () const
| returns true if the object needs evaluation to return a value, false if not More...
DLLLOCAL AbstractQoreNode & | operator= (const AbstractQoreNode &)
| this function is not implemented; it is here as a private function in order to prohibit it from being used
DLLEXPORT void | ref () const
| increments the reference count
DLLEXPORT AbstractQoreNode * | refSelf () const
| returns "this" with an incremented reference count More...
Public Member Functions inherited from QoreReferenceCounter
DLLEXPORT | QoreReferenceCounter ()
| creates the reference counter object
DLLEXPORT | QoreReferenceCounter (const QoreReferenceCounter &old)
| creates a new object with a reference count of 1 More...
DLLEXPORT | ~QoreReferenceCounter ()
| destroys the reference counter object
DLLEXPORT bool | is_unique () const
| returns true if the reference count is 1 More...
DLLEXPORT int | reference_count () const
| gets the reference count More...
DLLEXPORT bool | ROdereference () const
| atomically decrements the reference count More...
DLLEXPORT void | ROreference () const
| atomically increments the reference count
Public Member Functions inherited from DateTime
DLLEXPORT | DateTime (bool r=false)
| constructor for an empty object More...
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)
| constructor for setting all parameters More...
DLLEXPORT | DateTime (int64 seconds)
| constructor for setting an absolute date based on the number of seconds from January 1, 1970 More...
DLLEXPORT | DateTime (int64 seconds, int ms)
| constructor for setting an absolute date based on the number of seconds from January 1, 1970 (plus milliseconds) More...
DLLEXPORT | DateTime (const AbstractQoreZoneInfo *zone, const QoreValue v)
| constructor for creating an absolute date from a value representing a number of seconds More...
DLLEXPORT | DateTime (const QoreValue v)
| constructor for creating a relative date from a value representing a number of seconds More...
DLLEXPORT | DateTime (const char *date)
| constructor for setting the date from a string More...
DLLEXPORT | DateTime (const char *date, ExceptionSink *xsink)
| constructor for setting the date from a string with a flexible format, throws a Qore-language exception if the date string is invalid More...
DLLEXPORT | DateTime (const AbstractQoreZoneInfo *zone, const char *date)
| constructor for setting the date from a string with a flexible format More...
DLLEXPORT | DateTime (const struct tm *tms)
| constructor for setting an absolute date based on a "struct tm" More...
DLLEXPORT | DateTime (const DateTime &dt)
| copy constructor
DLLEXPORT | ~DateTime ()
| destroys the object and frees all memory
DLLEXPORT void | addSecondsTo (int64 secs, int us=0)
| adds the given number of seconds (and microseconds) to the date/time value More...
DLLEXPORT void | format (QoreString &str, const char *fmt) const
| formats the date/time value to a QoreString More...
DLLEXPORT int | getDay () const
| returns the day portion of the date-time value (in local time according to the time zone for absolute date/time values) More...
DLLEXPORT int | getDayNumber () const
| returns the ordinal number of the day in the year for absolute dates, sometimes (mistakenly) referred to as the Julian date More...
DLLEXPORT int | getDayOfWeek () const
| returns the day of week for the current date (0-6, Sun-Sat) More...
DLLEXPORT int64 | getEpochMicrosecondsUTC () const
| gets the number of microseconds since January 1, 1970Z for the current date More...
DLLEXPORT int64 | getEpochMillisecondsUTC () const
| gets the number of milliseconds since January 1, 1970Z for the current date More...
DLLEXPORT int64 | getEpochSeconds () const
| gets the number of seconds since January 1, 1970 for the current date offset in local time More...
DLLEXPORT int64 | getEpochSecondsUTC () const
| gets the number of seconds since January 1, 1970Z for the current date More...
DLLEXPORT int | getHour () const
| returns the hour portion of the date-time value (in local time according to the time zone for absolute date/time values) More...
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 | getInfo (qore_tm &info) const
| returns the broken-down time in the current time zone
DLLEXPORT void | getISOWeek (int &year, int &week, int &day) const
| returns the ISO-8601 week information More...
DLLEXPORT int | getMicrosecond () const
| returns the microsecond portion of the date-time value More...
DLLEXPORT int | getMillisecond () const
| returns the microsecond portion of the date-time value divided by 1000 More...
DLLEXPORT int | getMinute () const
| returns the minute portion of the date-time value (in local time according to the time zone for absolute date/time values) More...
DLLEXPORT int | getMonth () const
| returns the month portion of the date-time value (in local time according to the time zone for absolute date/time values) More...
DLLEXPORT int64 | getRelativeMicroseconds () const
| returns the difference as the number of microseconds between the date/time value and the local time at the moment of the call, for absolute date/time values; for relative date/time values, the duration is converted to microseconds and returned as an integer More...
DLLEXPORT int64 | getRelativeMilliseconds () const
| returns the difference as the number of milliseconds between the date/time value and the local time at the moment of the call, for absolute date/time values; for relative date/time values, the duration is converted to milliseconds and returned as an integer More...
DLLEXPORT int64 | getRelativeSeconds () const
| returns the difference as the number of seconds between the date/time value and the local time at the moment of the call for absolute date/time values; for relative date/time values, the duration is converted to seconds and returned as an integer More...
DLLEXPORT double | getRelativeSecondsDouble () const
| returns the difference as the number of seconds between the date/time value and the local time at the moment of the call for absolute date/time values; for relative date/time values, the duration is converted to seconds and returned as a floating-point value with fractional seconds as digits to the right of the decimal point More...
DLLEXPORT int | getSecond () const
| returns the second portion of the date-time value (in local time according to the time zone for absolute date/time values) More...
DLLEXPORT void | getTM (struct tm *tms) const
| sets a "struct tm" from the current date/time value for the time zone for the object; use DateTime::getInfo() instead
DLLEXPORT short | getYear () const
| returns the year portion of the date-time value (in local time according to the time zone for absolute date/time values) More...
DLLEXPORT const AbstractQoreZoneInfo * | getZone () const
| gets the time zone for the object; returns 0 for relative date/time values
DLLEXPORT bool | hasValue () const
| returns true if the object has a value, false if not (zero value = 1970-01-01Z for absolute times, or all relative components = 0)
DLLEXPORT bool | isAbsolute () const
| returns true if the value is an absolute date-time value More...
DLLEXPORT bool | isRelative () const
| returns true if the value is a relative date-time value More...
DLLEXPORT void | setDate (int64 seconds)
| sets the absolute date value based on the number of seconds from January 1, 1970 More...
DLLEXPORT void | setDate (int64 seconds, int ms)
| sets the absolute date value based on the number of seconds from January 1, 1970 UTC (plus milliseconds) More...
DLLEXPORT void | setDate (const AbstractQoreZoneInfo *zone, int64 seconds, int us)
| sets the absolute date value based on the number of seconds from January 1, 1970 UTC (plus microseconds) More...
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)
| sets the date to an absolute date/time as given
DLLEXPORT void | setDate (const char *str)
| sets an absolute date value from a string with a flexible format More...
DLLEXPORT void | setDate (const char *str, ExceptionSink *xsink)
| sets an absolute date value from a string with a flexible format More...
DLLEXPORT void | setDate (const AbstractQoreZoneInfo *zone, const char *str)
| sets an absolute date value from a time zone pointer and a string with a flexible format More...
DLLEXPORT void | setDate (const struct tm *tms, short ms=0)
| sets the absolute date from a "struct tm" pointer and millisecond value
DLLEXPORT void | setDate (const DateTime &date)
| sets the date from a DateTime reference
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 zone (plus microseconds) More...
DLLEXPORT void | setNow ()
| sets the current date and time in the current time zone; current contents are overwritten More...
DLLEXPORT void | setNow (const AbstractQoreZoneInfo *zone)
| sets the current date and time in the given time zone; current contents are overwritten More...
DLLEXPORT void | setRelativeDate (const char *str)
| sets a relative date from a string in the format YYYYMMDDHHmmSS
DLLEXPORT void | setRelativeDateSeconds (int64 s, int us=0)
| set the object to a relative date/time value as given in seconds and optionally microseconds
DLLEXPORT void | setTime (int h, int m, int s, short ms=0)
| sets the time from hours, minutes, seconds, and milliseconds More...
DLLEXPORT void | setZone (const AbstractQoreZoneInfo *n_zone)
| changes the time zone for the time without updating the epoch offset
DLLEXPORT DateTime * | unaryMinus () const
| returns the negative time from the current time
DLLEXPORT void | unaryMinusInPlace ()
| converts the current value to the negative of itself

## Static Public Member Functions

static DLLEXPORT DateTimeNode * | getDateFromISOWeek (int year, int week, int day, ExceptionSink *xsink)
| returns a DateTimeNode value as generated from the ISO-8601 week information More...
static DLLLOCAL qore_type_t | getStaticTypeCode ()
| returns the type code (useful in templates)
static DLLLOCAL const char * | getStaticTypeName ()
| returns the type name (useful in templates)
static DLLEXPORT DateTimeNode * | 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 DateTimeNode * | makeAbsolute (const AbstractQoreZoneInfo *n_zone, int n_year, int n_month, int n_day, int n_hour, int n_minute, int n_second, int n_us, ExceptionSink *xsink)
| static "constructor" to create an absolute time, including microseconds, throws an exception with invalid date/time components More...
static DLLEXPORT DateTimeNode * | makeAbsolute (const AbstractQoreZoneInfo *zone, int64 seconds, int us=0)
| static "constructor" to create an absolute time as an offset from the epoch, including microseconds More...
static DLLEXPORT DateTimeNode * | 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, including microseconds More...
static DLLEXPORT DateTimeNode * | 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
static DLLEXPORT DateTimeNode * | makeRelativeFromSeconds (int64 n_second, int n_us=0)
| static "constructor" to create a relative time, including microseconds
Static Public Member Functions inherited from DateTime
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
static DLLEXPORT DateTime * | getDateFromISOWeek (int year, int week, int day, ExceptionSink *xsink)
| returns a DateTime value from ISO-8601 week and day offsets More...
static DLLEXPORT int | getLastDayOfMonth (int month, int year)
| returns the number of days in the month given according to a proleptic gregorian calendar
static DLLEXPORT bool | isLeapYear (int year)
| returns true if the year passed is a leap year according to a proleptic gregorian calendar
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 * | makeAbsolute (const AbstractQoreZoneInfo *zone, int64 seconds, int us=0)
| static "constructor" to create an absolute time as an offset from the epoch, including microseconds More...
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, including microseconds More...
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
static DLLEXPORT DateTime * | makeRelativeFromSeconds (int64 n_second, int n_us=0)
| static "constructor" to create a relative time, including microseconds

## Protected Member Functions

virtual DLLEXPORT | ~DateTimeNode ()
| protected destructor only called when references = 0, use deref() instead
Protected Member Functions inherited from SimpleValueQoreNode
virtual DLLEXPORT QoreValue | evalImpl (bool &needs_deref, ExceptionSink *xsink) const
| should never be called for value types More...
Protected Member Functions inherited from AbstractQoreNode
virtual DLLEXPORT | ~AbstractQoreNode ()
| default destructor does nothing More...
Protected Member Functions inherited from DateTime
DLLLOCAL | DateTime (qore_date_private *n_priv)
| this constructor is not exported in the library
DLLLOCAL DateTime & | operator= (const DateTime &)
| this function is not implemented; it is here as a private function in order to prohibit it from being used

## Additional Inherited Members

Protected Attributes inherited from AbstractQoreNode
bool | custom_reference_handlers: 1
| set to one for objects that need custom reference handlers
bool | needs_eval_flag: 1
| if this is true then the type can be evaluated
bool | there_can_be_only_one: 1
| if this is set to true, then reference counting is turned off for objects of this class
qore_type_t | type: 11
| the type of the object More...
bool | value: 1
| this is true for values, if false then either the type needs evaluation to produce a value or is a parse expression
Protected Attributes inherited from DateTime
class qore_date_private * | priv
| private date data - most are ints so relative dates can hold a lot of data

## Detailed Description

Qore's parse tree/value type for date-time values, reference-counted, dynamically-allocated only.

## Constructor & Destructor Documentation

## DateTimeNode() [1/10]

DLLEXPORT DateTimeNode::DateTimeNode | ( | bool | r = `false` | ) |

constructor for an empty object

Parameters

  r | sets the "relative" flag for the object

## DateTimeNode() [2/10]

DLLEXPORT DateTimeNode::DateTimeNode | ( | 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`
| ) |  |

constructor for setting all parameters

Parameters

  n_year | the year value
  n_month | the months value
  n_day | the days value
  n_hour | the hours value
  n_minute | the minutes value
  n_second | the seconds value
  n_ms | the milliseconds value
  n_relative | the relative flag

## DateTimeNode() [3/10]

DLLEXPORT DateTimeNode::DateTimeNode | ( | int64 | seconds | ) |

constructor for setting an absolute date based on the number of seconds from January 1, 1970

Parameters

  seconds | the number of seconds from January 1, 1970

## DateTimeNode() [4/10]

DLLEXPORT DateTimeNode::DateTimeNode | ( | int64 | seconds,
|  | int | ms
| ) |  |

constructor for setting an absolute date based on the number of seconds from January 1, 1970 (plus milliseconds)

Parameters

  seconds | the number of seconds from January 1, 1970
  ms | the milliseconds portion of the time

## DateTimeNode() [5/10]

DLLEXPORT DateTimeNode::DateTimeNode | ( | const AbstractQoreZoneInfo * | zone,
|  | const QoreValue | v
| ) |  |

explicit

constructor for creating an absolute date from a value representing a number of seconds

Parameters

  zone | time zone for the date/time value, 0 = UTC,

See also
  currentTZ()

Parameters

  v | the value representing the number of seconds representing the offset from the epoch (1970-01-01)

Note
  the zone argument is the assumed time zone for values without a specified time zone; for example, if the value is a string with a time zone specification then the zone argument is ignored

## DateTimeNode() [6/10]

DLLEXPORT DateTimeNode::DateTimeNode | ( | const QoreValue | v | ) |

explicit

constructor for creating a relative date from a value representing a number of seconds

Parameters

  v | the value representing the number of seconds

## DateTimeNode() [7/10]

DLLEXPORT DateTimeNode::DateTimeNode | ( | const char * | date | ) |

constructor for setting the date from a string with a flexible format, silently accepts invalid date strings

Parameters

  date | the string to use to set the date

## DateTimeNode() [8/10]

DLLEXPORT DateTimeNode::DateTimeNode | ( | const char * | date,
|  | ExceptionSink * | xsink
| ) |  |

constructor for setting the date from a string with a flexible format, throws a Qore-language exception if the date string is invalid

Parameters

  date | the string to use to set the date
  xsink | any errors in the data string cause a Qore-language exception to be thrown here

Since
  Qore 0.8.12.4

## DateTimeNode() [9/10]

DLLEXPORT DateTimeNode::DateTimeNode | ( | const AbstractQoreZoneInfo * | zone,
|  | const char * | date
| ) |  |

constructor for setting the date from a string with a flexible format

Parameters

  zone | time zone for the date/time value, 0 = UTC,

See also
  currentTZ()

Parameters

  date | the string to use to set the date

## DateTimeNode() [10/10]

DLLEXPORT DateTimeNode::DateTimeNode | ( | struct tm * | tms | ) |

constructor for setting an absolute date based on a "struct tm"

Parameters

  tms | a structure giving the absolute date to set

## Member Function Documentation

## add() [1/2]

DLLEXPORT DateTimeNode* DateTimeNode::add | ( | const DateTime * | dt | ) | const

adds a DateTime value to the current value and returns the new value, the caller owns the pointer's reference count

Returns
  a new DateTimeNode value, the caller owns the pointer's reference count

## add() [2/2]

DLLEXPORT DateTimeNode* DateTimeNode::add | ( | const DateTime & | dt | ) | const

adds a DateTime value to the current value and returns the new value, the caller owns the pointer's reference count

Returns
  a new DateTimeNode value, the caller owns the pointer's reference count

## copy()

DLLEXPORT DateTimeNode* DateTimeNode::copy | ( |  | ) | const

returns a copy of the DateTimeNode, the caller owns the pointer's reference count

Returns
  a copy of the DateTimeNode, the caller owns the pointer's reference count

## getAsString() [1/2]

virtual DLLEXPORT QoreString* DateTimeNode::getAsString | ( | bool & | del,
|  | int | foff,
|  | ExceptionSink * | xsink
| ) |  | const

virtual

returns the date/time value as a formatted string for n and N printf formatting, del is set to true

the format for absolute date/time value is: YYYY-MM-DD HH:mm:SS the format for relative date/time values is: <time: x years, x months, ...> NOTE: do not use this function directly, use QoreStringValueHelper instead

Parameters

  del | output parameter: always set to true by this function, meaning that the caller owns the QoreString pointer returned (and must delete it manually)
  foff | ignored for this implementation of the file
  xsink | ignored for this implementation of the file

Returns
  a QoreString pointer, use the del output parameter to determine ownership of the pointer

See also
  QoreStringValueHelper

Implements AbstractQoreNode.

## getAsString() [2/2]

virtual DLLEXPORT int DateTimeNode::getAsString | ( | QoreString & | str,
|  | int | foff,
|  | ExceptionSink * | xsink
| ) |  | const

virtual

concatenates a string representation of the date/time value (designed for n and N printf formatting) to a QoreString reference

the format for absolute date/time value is: YYYY-MM-DD HH:mm:SS the format for relative date/time values is: <time: x years, x months, ...>

Parameters

  str | the QoreString reference to concatenate the date/time value to
  foff | ignored for this implementation of the file
  xsink | ignored for this implementation of the file

See also
  QoreNodeAsStringHelper

Implements AbstractQoreNode.

## getDateFromISOWeek()

static DLLEXPORT DateTimeNode* DateTimeNode::getDateFromISOWeek | ( | int | year,
|  | int | week,
|  | int | day,
|  | ExceptionSink * | xsink
| ) |  |

static

returns a DateTimeNode value as generated from the ISO-8601 week information

NOTE: ISO-8601 week days go from 1 - 7 = Mon - Sun, a 0 return value means an exception was raised in the case the ISO-8601 week information is invalid

Parameters

  year | the ISO-8601 year (may differ from the actual calendar year)
  week | the ISO-8601 week number in the year
  day | the ISO-8601 day number (1=Mon, 7=Sun)
  xsink | if an error occurs, the Qore-language exception information will be added here

## getDateTimeRepresentation() [1/2]

virtual DLLEXPORT DateTime* DateTimeNode::getDateTimeRepresentation | ( | bool & | del | ) | const

virtual

returns "this" as a DateTime, del is set to false

NOTE: Use the DateTimeValueHelper class instead of using this function directly

Parameters

  del | output parameter: if del is true, then the returned DateTime pointer belongs to the caller (and must be deleted manually), if false, then it must not be

See also
  DateTimeValueHelper

Reimplemented from AbstractQoreNode.

## getDateTimeRepresentation() [2/2]

virtual DLLEXPORT void DateTimeNode::getDateTimeRepresentation | ( | DateTime & | dt | ) | const

virtual

assigns this date/time representation to the passed DateTime reference

Parameters

  dt | the reference where the current date/time value will be copied

Reimplemented from AbstractQoreNode.

## getStringRepresentation() [1/2]

virtual DLLEXPORT QoreString* DateTimeNode::getStringRepresentation | ( | bool & | del | ) | const

virtual

returns a string in the format YYYYMMDDHHmmSS, del is set to true

NOTE: do not use this function directly, use QoreStringValueHelper instead

Parameters

  del | output parameter: if del is true, then the resulting QoreString pointer belongs to the caller (and must be deleted manually), if false it must not be

Returns
  a QoreString pointer, use the del output parameter to determine ownership of the pointer

See also
  QoreStringValueHelper

Reimplemented from AbstractQoreNode.

## getStringRepresentation() [2/2]

virtual DLLEXPORT void DateTimeNode::getStringRepresentation | ( | QoreString & | str | ) | const

virtual

concatentates the date/time value in the format YYYYMMDDHHmmDD to an existing QoreString reference

Parameters

  str | a reference to a QoreString where date/time value will be concatenated in the format YYYYMMDDHHmmDD

Reimplemented from AbstractQoreNode.

## is_equal_hard()

virtual DLLEXPORT bool DateTimeNode::is_equal_hard | ( | const AbstractQoreNode * | v,
|  | ExceptionSink * | xsink
| ) |  | const

virtual

tests for equality ("deep compare" including all contained values for container types) without type conversions (hard compare)

Parameters

  v | the value to compare
  xsink | if an error occurs, the Qore-language exception information will be added here

Returns
  true if the objects are equal, false if not

Implements AbstractQoreNode.

## is_equal_soft()

virtual DLLEXPORT bool DateTimeNode::is_equal_soft | ( | const AbstractQoreNode * | v,
|  | ExceptionSink * | xsink
| ) |  | const

virtual

tests for equality with possible type conversion (soft compare)

this function does not throw any Qore-language exceptions

Parameters

  v | the value to compare
  xsink | is not used in this implementation of the function

Implements AbstractQoreNode.

## makeAbsolute() [1/2]

static DLLEXPORT DateTimeNode* DateTimeNode::makeAbsolute | ( | const AbstractQoreZoneInfo * | n_zone,
|  | int | n_year,
|  | int | n_month,
|  | int | n_day,
|  | int | n_hour,
|  | int | n_minute,
|  | int | n_second,
|  | int | n_us,
|  | ExceptionSink * | xsink
| ) |  |

static

static "constructor" to create an absolute time, including microseconds, throws an exception with invalid date/time components

Since
  Qore 0.8.12.4

## makeAbsolute() [2/2]

static DLLEXPORT DateTimeNode* DateTimeNode::makeAbsolute | ( | const AbstractQoreZoneInfo * | zone,
|  | int64 | seconds,
|  | int | us = `0`
| ) |  |

static

static "constructor" to create an absolute time as an offset from the epoch, including microseconds

Parameters

  zone | time zone for the date/time value, 0 = UTC,

See also
  currentTZ()

Parameters

  seconds | the number of seconds from January 1, 1970
  us | the microseconds portion of the time

## makeAbsoluteLocal()

static DLLEXPORT DateTimeNode* DateTimeNode::makeAbsoluteLocal | ( | const AbstractQoreZoneInfo * | zone,
|  | int64 | seconds,
|  | int | us = `0`
| ) |  |

static

static "constructor" to create an absolute time as an offset from the given time zone's epoch, including microseconds

Parameters

  zone | time zone for the date/time value, 0 = UTC,

See also
  currentTZ()

Parameters

  seconds | the number of seconds from January 1, 1970 in the time zone passed as the first argument
  us | the microseconds portion of the time

## realCopy()

virtual DLLEXPORT AbstractQoreNode* DateTimeNode::realCopy | ( |  | ) | const

virtual

returns a copy of the object; the caller owns the reference count

Returns
  a copy of the object; the caller owns the reference count

Implements AbstractQoreNode.

## subtractBy() [1/2]

DLLEXPORT DateTimeNode* DateTimeNode::subtractBy | ( | const DateTime * | dt | ) | const

subtracts a DateTime value from the current value and returns the new value, the caller owns the pointer's reference count

Returns
  a new DateTimeNode value, the caller owns the pointer's reference count

## subtractBy() [2/2]

DLLEXPORT DateTimeNode* DateTimeNode::subtractBy | ( | const DateTime & | dt | ) | const

subtracts a DateTime value from the current value and returns the new value, the caller owns the pointer's reference count

Returns
  a new DateTimeNode value, the caller owns the pointer's reference count

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

- include/qore/DateTimeNode.h