diff --git a/docs-2.0/3.ngql-guide/3.data-types/4.date-and-time.md b/docs-2.0/3.ngql-guide/3.data-types/4.date-and-time.md index 0bd4e23f70c..522bf0043d0 100644 --- a/docs-2.0/3.ngql-guide/3.data-types/4.date-and-time.md +++ b/docs-2.0/3.ngql-guide/3.data-types/4.date-and-time.md @@ -157,7 +157,18 @@ The `DURATION` data type is used to indicate a period of time. Map data that are nebula> INSERT VERTEX date1(p1, p2, p3) VALUES "test1":(date("2021-03-17"), time("17:53:59"), datetime("2017-03-04T22:30:40.003000[Asia/Shanghai]")); ``` -3. Return the content of the property `p1` on `test1`. +3. Query whether the value of property `p1` on the `test1` tag is `2021-03-17`. + + ```ngql + nebula> MATCH (v:date1) RETURN v.date1.p1 == date("2021-03-17"); + +----------------------------------+ + | (v.date1.p1==date("2021-03-17")) | + +----------------------------------+ + | true | + +----------------------------------+ + ``` + +4. Return the content of the property `p1` on `test1`. ```ngql nebula> CREATE TAG INDEX IF NOT EXISTS date1_index ON date1(p1); @@ -170,13 +181,26 @@ The `DURATION` data type is used to indicate a period of time. Map data that are +------------------+ ``` -4. Create a tag named `school` with the property of `TIMESTAMP`. +5. Search for vertices with `p3` property values less than `2023-01-01T00:00:00.000000`, and return the `p3` values. + + ```ngql + nebula> MATCH (v:date1) \ + WHERE v.date1.p3 < datetime("2023-01-01T00:00:00.000000") \ + RETURN v.date1.p3; + +----------------------------+ + | v.date1.p3 | + +----------------------------+ + | 2017-03-04T14:30:40.003000 | + +----------------------------+ + ``` + +6. Create a tag named `school` with the property of `TIMESTAMP`. ```ngql nebula> CREATE TAG IF NOT EXISTS school(name string , found_time timestamp); ``` -5. Insert a vertex named `DUT` with a found-time timestamp of `"1988-03-01T08:00:00"`. +7. Insert a vertex named `DUT` with a found-time timestamp of `"1988-03-01T08:00:00"`. ```ngql # Insert as a timestamp. The corresponding timestamp of 1988-03-01T08:00:00 is 573177600, or 573206400 UTC. @@ -186,7 +210,7 @@ The `DURATION` data type is used to indicate a period of time. Map data that are nebula> INSERT VERTEX school(name, found_time) VALUES "DUT":("DUT", timestamp("1988-03-01T08:00:00")); ``` -6. Insert a vertex named `dut` and store time with `now()` or `timestamp()` functions. +8. Insert a vertex named `dut` and store time with `now()` or `timestamp()` functions. ```ngql # Use now() function to store time