company logo

DateTime :: compare - Compare timestamps

The function compares the timestamp stored in the object with the timestamp passed in the parameter.

The function returns -1 when the timestamp is lower than the timestamp passed as parameter, 1 when the the timestamp is greater than the one passed and 0, when both values are equal.

The function throws an exception, when values are invalid or not comparable.

Return value:  Compare result ( int32  )

The result of a comparison is an integer value with the following meaning:

  • 0: both operands have the same value
  • 1: the calling operand is greater than the passed operand
  • -1: the calling operand is smaller than the passed operand

Implementation overview

Implementation details

  1. Compare timestamp value with string timestamp
    int32 DateTime  :: compare ( odaba::String &sDateTime )

    The function compares the timestamp value with the timestamp passed in sDateTime.

    • sDateTime - DateTime value in string format

      Date time values in string format are passed as follows:

          date time

      Date and time are separated by exactly one blank character. Date has to be passed in one of following date string formats.

              Standard: yyyy-mm-dd or yyyymmdd

              English:     mm/dd/yyyy

              German:     dd.mm.yyyy

      Time has to be passed as:

              hh[:mm[:ss[,cc]]]

      Time values must not contain spaces.

        2009-11-19 11:23:17,43

  2. to list
  3. Compare two timestamps
    int32 DateTime  :: compare ( odaba::DateTime &cDateTime )

    The function compares the date value with the date value passed in cDateTime.

    • cDateTime - Time stamp

      A time stamp combines date and time

  4. to list