-
Notifications
You must be signed in to change notification settings - Fork 64
Document temporal parsing #1392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
3f1ae26
c77f04f
bf9d210
ccaa206
beca803
a7595ad
f20d685
61269d0
8856b01
6cad915
42bcf67
434314d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -16,10 +16,11 @@ See also xref::values-and-types/temporal.adoc[Temporal values] and xref::express | |||||
|
|
||||||
| .Details | ||||||
| |=== | ||||||
| | *Syntax* 3+| `duration(input)` | ||||||
| | *Syntax* 3+| `duration(input[, pattern])` | ||||||
| | *Description* 3+| Creates a `DURATION` value. | ||||||
| .2+| *Arguments* | *Name* | *Type* | *Description* | ||||||
| .3+| *Arguments* | *Name* | *Type* | *Description* | ||||||
| | `input` | `ANY` | A map optionally containing the following keys: 'years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds', 'milliseconds', 'microseconds', or 'nanoseconds'. | ||||||
| | `pattern` | `STRING` | A pattern used to parse the input. If a pattern is provided, `input` must be `STRING`. | ||||||
Lojjs marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| | *Returns* 3+| `DURATION` | ||||||
| |=== | ||||||
|
|
||||||
|
|
@@ -33,6 +34,7 @@ See also xref::values-and-types/temporal.adoc[Temporal values] and xref::express | |||||
| | The values of the parameters may be arbitrarily large. | ||||||
| | The values of the parameters may be negative. | ||||||
| | The xref:values-and-types/temporal.adoc#cypher-temporal-accessing-components-durations[components of `DURATION` objects] are individually accessible. | ||||||
| | The `pattern` parameter follows the link:https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/format/DateTimeFormatter.html[Java DateTimeFormatter]. | ||||||
|
||||||
|
|
||||||
| |=== | ||||||
|
|
||||||
|
|
@@ -85,7 +87,8 @@ duration("P14DT16H12M"), | |||||
| duration("P5M1.5D"), | ||||||
| duration("P0.75M"), | ||||||
| duration("PT0.75M"), | ||||||
| duration("P2012-02-02T14:37:21.545") | ||||||
| duration("P2012-02-02T14:37:21.545"), | ||||||
| duration("5 hours 6 minutes", "h 'hours' m 'minutes'") | ||||||
| ] AS aDuration | ||||||
| RETURN aDuration | ||||||
| ---- | ||||||
|
|
@@ -101,7 +104,8 @@ RETURN aDuration | |||||
| | P22DT19H51M49.5S | ||||||
| | PT45S | ||||||
| | P2012Y2M2DT14H37M21.545S | ||||||
| 1+d|Rows: 5 | ||||||
| | P5H6M | ||||||
|
||||||
| | P5H6M | |
| | PT5H6M |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this really be under duration.between() and not in the other bullet point list under duration()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy-paste error i think :) removed it
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -332,13 +332,15 @@ The following table lists the supported truncation units and the corresponding s | |
|
|
||
| .Details | ||
| |=== | ||
| | *Syntax* 3+| `date( [input] )` | ||
| | *Syntax* 3+| `date([ input, pattern] )` | ||
| | *Description* 3+| Creates a `DATE` instant. | ||
| .2+| *Arguments* | *Name* | *Type* | *Description* | ||
| .3+| *Arguments* | *Name* | *Type* | *Description* | ||
| | `input` | `ANY` | Either a string representation of a temporal value, a map containing the single key 'timezone', or a map containing temporal values ('date', 'year', 'month', 'day', 'week', 'dayOfWeek', 'quarter', 'dayOfQuarter', 'ordinalDay') as components. | ||
| | `pattern` | `STRING` | A pattern used to parse the input. If a pattern is provided, `input` must be `STRING`. | ||
| | *Returns* 3+| `DATE` | ||
| |=== | ||
|
|
||
|
|
||
| .Temporal components | ||
| [options="header"] | ||
| |=== | ||
|
|
@@ -393,6 +395,7 @@ The following table lists the supported truncation units and the corresponding s | |
| | `date(null)` returns `null`. | ||
| | If any of the optional parameters are provided, these will override the corresponding components of `date`. | ||
| | `date(dd)` may be written instead of `+date({date: dd})+`. | ||
| | The `pattern` parameter follows the link:https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/format/DateTimeFormatter.html[Java DateTimeFormatter]. | ||
|
|
||
| |=== | ||
|
|
||
|
|
@@ -604,7 +607,8 @@ date('2015-07'), | |
| date('201507'), | ||
| date('2015-W30-2'), | ||
| date('2015202'), | ||
| date('2015') | ||
| date('2015'), | ||
| date('11/18/1986', "MM/dd/yyyy") | ||
| ] AS theDate | ||
| RETURN theDate | ||
| ---- | ||
|
|
@@ -620,7 +624,8 @@ RETURN theDate | |
| | 2015-07-21 | ||
| | 2015-07-21 | ||
| | 2015-01-01 | ||
| 1+d|Rows: 6 | ||
| | 1986-11-18 | ||
| 1+d|Rows: 7 | ||
|
|
||
| |=== | ||
|
|
||
|
|
@@ -841,10 +846,11 @@ RETURN | |
|
|
||
| .Details | ||
| |=== | ||
| | *Syntax* 3+| `datetime([ input ])` | ||
| | *Syntax* 3+| `datetime([ input, pattern ])` | ||
| | *Description* 3+| Creates a `ZONED DATETIME` instant. | ||
| .2+| *Arguments* | *Name* | *Type* | *Description* | ||
| .3+| *Arguments* | *Name* | *Type* | *Description* | ||
| | `input` | `ANY` | Either a string representation of a temporal value, a map containing the single key 'timezone', or a map containing temporal values ('year', 'month', 'day', 'hour', 'minute', 'second', 'millisecond', 'microsecond', 'nanosecond', 'timezone') as components. | ||
| | `pattern` | `STRING` | A pattern used to parse the input. If a pattern is provided, `input` must be `STRING`. | ||
| | *Returns* 3+| `ZONED DATETIME` | ||
| |=== | ||
|
|
||
|
|
@@ -914,6 +920,7 @@ RETURN | |
| | Selecting a `ZONED DATETIME` or `ZONED TIME` as the `time` component and overwriting the timezone will adjust the local time to keep the same point in time. | ||
| | `epochSeconds`/`epochMillis` may be used in conjunction with `nanosecond`. | ||
| | `datetime(null)` returns null. | ||
| | The `pattern` parameter follows the link:https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/format/DateTimeFormatter.html[Java DateTimeFormatter]. | ||
|
||
|
|
||
| |=== | ||
|
|
||
|
|
@@ -1118,7 +1125,8 @@ datetime('20150721T21:40-01:30'), | |
| datetime('2015-W30T2140-02'), | ||
| datetime('2015202T21+18:00'), | ||
| datetime('2015-07-21T21:40:32.142[Europe/London]'), | ||
| datetime('2015-07-21T21:40:32.142-04[America/New_York]') | ||
| datetime('2015-07-21T21:40:32.142-04[America/New_York]'), | ||
| datetime('Tuesday, November 18, AD 1986', 'EEEE, MMMM d, G uuuu') | ||
| ] AS theDate | ||
| RETURN theDate | ||
| ---- | ||
|
|
@@ -1136,7 +1144,8 @@ RETURN theDate | |
| | 2015-07-21T21:00+18:00 | ||
| | 2015-07-21T21:40:32.142+01:00[Europe/London] | ||
| | 2015-07-21T21:40:32.142-04:00[America/New_York] | ||
| 1+d|Rows: 8 | ||
| | 1986-11-18T00:00Z | ||
| 1+d|Rows: 9 | ||
|
|
||
| |=== | ||
|
|
||
|
|
@@ -1599,10 +1608,11 @@ RETURN | |
|
|
||
| .Details | ||
| |=== | ||
| | *Syntax* 3+| `localdatetime([ input ])` | ||
| | *Syntax* 3+| `localdatetime([ input, pattern ])` | ||
| | *Description* 3+| Creates a `LOCAL DATETIME` instant. | ||
| .2+| *Arguments* | *Name* | *Type* | *Description* | ||
| .3+| *Arguments* | *Name* | *Type* | *Description* | ||
| | `input` | `ANY` | Either a string representation of a temporal value, a map containing the single key 'timezone', or a map containing temporal values ('year', 'month', 'day', 'hour', 'minute', 'second', 'millisecond', 'microsecond', 'nanosecond') as components. | ||
| | `pattern` | `STRING` | A pattern used to parse the input. If a pattern is provided, `input` must be `STRING`. | ||
| | *Returns* 3+| `LOCAL DATETIME` | ||
| |=== | ||
|
|
||
|
|
@@ -1661,6 +1671,7 @@ RETURN | |
| | `localdatetime(null)` returns null. | ||
| | If any of the optional parameters are provided, these will override the corresponding components of `datetime`, `date` and/or `time`. | ||
| | `localdatetime(dd)` may be written instead of `+localdatetime({datetime: dd})+`. | ||
| | The `pattern` parameter follows the link:https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/format/DateTimeFormatter.html[Java DateTimeFormatter]. | ||
|
|
||
| |=== | ||
|
|
||
|
|
@@ -1829,7 +1840,8 @@ UNWIND [ | |
| localdatetime('2015-07-21T21:40:32.142'), | ||
| localdatetime('2015-W30-2T214032.142'), | ||
| localdatetime('2015-202T21:40:32'), | ||
| localdatetime('2015202T21') | ||
| localdatetime('2015202T21'), | ||
| localdatetime('Tuesday, November 18, AD 1986', 'EEEE, MMMM d, G uuuu') | ||
| ] AS theDate | ||
| RETURN theDate | ||
| ---- | ||
|
|
@@ -1843,7 +1855,8 @@ RETURN theDate | |
| | 2015-07-21T21:40:32.142 | ||
| | 2015-07-21T21:40:32 | ||
| | 2015-07-21T21:00 | ||
| 1+d|Rows: 4 | ||
| | 1986-11-18T00:00Z | ||
| 1+d|Rows: 5 | ||
|
|
||
| |=== | ||
|
|
||
|
|
@@ -2179,10 +2192,11 @@ RETURN | |
|
|
||
| .Details | ||
| |=== | ||
| | *Syntax* 3+| `localtime([ input ])` | ||
| | *Syntax* 3+| `localtime([ input, pattern ])` | ||
| | *Description* 3+| Creates a `LOCAL TIME` instant. | ||
| .2+| *Arguments* | *Name* | *Type* | *Description* | ||
| .3+| *Arguments* | *Name* | *Type* | *Description* | ||
| | `input` | `ANY` | Either a string representation of a temporal value, a map containing the single key 'timezone', or a map containing temporal values ('hour, 'minute', 'second', 'millisecond', 'microsecond', 'nanosecond' as components. | ||
| | `pattern` | `STRING` | A pattern used to parse the input. If a pattern is provided, `input` must be `STRING`. | ||
| | *Returns* 3+| `LOCAL TIME` | ||
| |=== | ||
|
|
||
|
|
@@ -2227,6 +2241,7 @@ RETURN | |
| | `localtime(null)` returns null. | ||
| | If any of the optional parameters are provided, these will override the corresponding components of `time`. | ||
| | `localtime(tt)` may be written instead of `localtime({time: tt})`. | ||
| | The `pattern` parameter follows the link:https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/format/DateTimeFormatter.html[Java DateTimeFormatter]. | ||
|
|
||
| |=== | ||
|
|
||
|
|
@@ -2320,7 +2335,8 @@ UNWIND [ | |
| localtime('21:40:32.142'), | ||
| localtime('214032.142'), | ||
| localtime('21:40'), | ||
| localtime('21') | ||
| localtime('21'), | ||
| localtime('6:04', 'k:mm') | ||
| ] AS theTime | ||
| RETURN theTime | ||
| ---- | ||
|
|
@@ -2334,7 +2350,8 @@ RETURN theTime | |
| | 21:40:32.142 | ||
| | 21:40 | ||
| | 21:00 | ||
| 1+d|Rows: 4 | ||
| | 06:04 | ||
| 1+d|Rows: 5 | ||
|
|
||
| |=== | ||
|
|
||
|
|
@@ -2574,10 +2591,11 @@ RETURN | |
|
|
||
| .Details | ||
| |=== | ||
| | *Syntax* 3+| `time([ input ])` | ||
| | *Syntax* 3+| `time([ input, pattern ])` | ||
| | *Description* 3+| Creates a `ZONED TIME` instant. | ||
| .2+| *Arguments* | *Name* | *Type* | *Description* | ||
| .3+| *Arguments* | *Name* | *Type* | *Description* | ||
| | `input` | `ANY` | Either a string representation of a temporal value, a map containing the single key 'timezone', or a map containing temporal values ('hour', 'minute', 'second', 'millisecond', 'microsecond', 'nanosecond', 'timezone') as components. | ||
| | `pattern` | `STRING` | A pattern used to parse the input. If a pattern is provided, `input` must be `STRING`. | ||
| | *Returns* 3+| `ZONED TIME` | ||
| |=== | ||
|
|
||
|
|
@@ -2629,6 +2647,7 @@ RETURN | |
| | `time(tt)` may be written instead of `+time({time: tt})+`. | ||
| | Selecting a `ZONED TIME` or `ZONED DATETIME` value as the `time` component also selects its timezone. If a `LOCAL TIME` or `LOCAL DATETIME` is selected instead, the default timezone is used. In any case, the timezone can be overridden explicitly. | ||
| | Selecting a `ZONED DATETIME` or `ZONED TIME` as the `time` component and overwriting the timezone will adjust the local time to keep the same point in time. | ||
| | The `pattern` parameter follows the link:https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/format/DateTimeFormatter.html[Java DateTimeFormatter]. | ||
|
|
||
| |=== | ||
|
|
||
|
|
@@ -2733,7 +2752,8 @@ time('214032-0100'), | |
| time('21:40-01:30'), | ||
| time('2140-00:00'), | ||
| time('2140-02'), | ||
| time('22+18:00') | ||
| time('22+18:00'), | ||
| time('6:04', 'k:mm') | ||
| ] AS theTime | ||
| RETURN theTime | ||
| ---- | ||
|
|
@@ -2751,7 +2771,8 @@ RETURN theTime | |
| | 21:40:00Z | ||
| | 21:40:00-02:00 | ||
| | 22:00:00+18:00 | ||
| 1+d|Rows: 8 | ||
| | 06:04:00Z | ||
| 1+d|Rows: 9 | ||
|
|
||
| |=== | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.