--- title: "compare()" slug: "basic-compare" updated: 2026-08-13T06:53:22Z published: 2026-08-13T06:53:22Z canonical: "docs.lobstersoftware.com/basic-compare" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # compare() This function compares two (date) values **a** and **b**. The return value is: 1 if a > b. 0 if a = b. -1 if a < b. **IMPORTANT:** If date values are to be compared, they must be "real" date values and not strings. For example, from a field of type "Date" or from one of the date functions. ## Parameters | Parameter | Description | | --- | --- | | a | (Date) value 1. | | b | (Date) value 2. | ## Examples | Parameter a | Parameter b | Result | | --- | --- | --- | | 23 | 45 | -1 | | 45 | 23 | 1 | | 33 | 3 | 0 | | 2024-07-15 11:12:37.817 | 2025-07-15 11:12:37.817 | -1 | | 2025-07-15 11:12:37.817 | 2024-07-15 11:12:37.817 | 1 | | 2025-07-15 11:12:37.817 | 2025-07-15 11:12:37.817 | 0 | | aaa | bbb | 0 **NOTE:** Internal typecast of both values to 0) |