company logo

Date :: compare - Compare dates

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

The function returns -1 when the date is lower than the date passed as parameter, 1 when the the date 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 two dates
    int32 Date  :: compare ( odaba::Date &cDate )

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

    • cDate - Date

      The date contains day, month and year, but not the time.

  2. to list
  3. Compare date value with string data
    int32 Date  :: compare ( odaba::String &sDate )

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

    • sDate - Date value in string format

      Date values can be passed in different ways as string value:

              Standard: yyyy-mm-dd or yyyymmdd

              English:     mm/dd/yyyy

              German:     dd.mm.yyyy

      The type of date is determined from the separator used.

  4. to list