Skip to content

Commit 935e5a7

Browse files
committed
improved examples
1 parent 64a517c commit 935e5a7

File tree

2 files changed

+24
-67
lines changed

2 files changed

+24
-67
lines changed

modules/ROOT/pages/functions/temporal/format.adoc

Lines changed: 23 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ RETURN format(dt, "MM/dd/yyyy") AS EU, format(dt, "dd/MM/yyyy") AS US
6666
----
6767
6868
.Result
69-
[role="queryresult",options="header,footer",cols="1*<m"]
69+
[role="queryresult",options="header,footer",cols="2*<m"]
7070
|===
7171
72-
| x | y
72+
| EU | US
7373
| "11/18/1986" | "18/11/1986"
74-
1+d|Rows: 2
74+
2+d|Rows: 1
7575
7676
|===
7777
@@ -134,12 +134,12 @@ RETURN format(dt, "k:mm z") AS CET, format(dt, "K:mm O") AS GMT
134134
----
135135
136136
.Result
137-
[role="queryresult",options="header,footer",cols="1*<m"]
137+
[role="queryresult",options="header,footer",cols="2*<m"]
138138
|===
139139
140-
| x | y
140+
| CET | GMT
141141
| "6:04 CET" | "6:04 GMT+1"
142-
1+d|Rows: 2
142+
2+d|Rows: 1
143143
144144
|===
145145
@@ -264,66 +264,44 @@ For example, not all months have the same number of days, and switches to or fro
264264
[[query-functions-temporal-format-duration-types-examples]]
265265
=== Examples
266266

267-
.Duration formatting
267+
.Duration formatting, years converted to quarters
268268
======
269269
270270
.Query
271271
[source, cypher, indent=0]
272272
----
273273
WITH duration({years: 1, months: 4, weeks: 3, days: 4, hours: 5, minutes: 6, seconds: 7, milliseconds: 8, microseconds: 9, nanoseconds: 10}) AS d
274-
RETURN format(d, "y 'years' q 'quarters' M 'months' w 'weeks' d 'days' h 'hours' m 'minutes' s 'seconds' N 'nanos'") AS x
274+
RETURN format(d, "y 'years' q 'quarters' M 'months'") AS withYears, format(d, "q 'quarters' M 'months'") AS withoutYears
275275
----
276276
277277
.Result
278-
[role="queryresult",options="header,footer",cols="1*<m"]
278+
[role="queryresult",options="header,footer",cols="2*<m"]
279279
|===
280280
281-
| x
282-
| "1 years 1 quarters 1 months 3 weeks 4 days 5 hours 6 minutes 7 seconds 8009010 nanos"
283-
1+d|Rows: 1
281+
| withYears | withoutYears
282+
| "1 years 1 quarters 1 months" | "5 quarters 1 months"
283+
2+d|Rows: 1
284284
285285
|===
286286
======
287287

288-
.Duration formatting with years converted to quarters
288+
.Duration formatting, weeks converted to days
289289
======
290290
291291
.Query
292292
[source, cypher, indent=0]
293293
----
294294
WITH duration({years: 1, months: 4, weeks: 3, days: 4, hours: 5, minutes: 6, seconds: 7, milliseconds: 8, microseconds: 9, nanoseconds: 10}) AS d
295-
RETURN format(d, "q 'quarters' M 'months'") AS x
295+
RETURN format(d, "w 'weeks' d 'days'") AS withWeeks, format(d, "d 'days'") AS withoutWeeks
296296
----
297297
298298
.Result
299-
[role="queryresult",options="header,footer",cols="1*<m"]
299+
[role="queryresult",options="header,footer",cols="2*<m"]
300300
|===
301301
302-
| x
303-
| "5 quarters 1 months"
304-
1+d|Rows: 1
305-
306-
|===
307-
308-
======
309-
310-
.Duration formatting with weeks converted to days
311-
======
312-
313-
.Query
314-
[source, cypher, indent=0]
315-
----
316-
WITH duration({years: 1, months: 4, weeks: 3, days: 4, hours: 5, minutes: 6, seconds: 7, milliseconds: 8, microseconds: 9, nanoseconds: 10}) AS d
317-
RETURN format(d, "d 'days'") AS x
318-
----
319-
320-
.Result
321-
[role="queryresult",options="header,footer",cols="1*<m"]
322-
|===
323-
324-
| x
325-
| "25 days"
326-
1+d|Rows: 1
302+
| withWeeks | withoutWeeks
303+
| "3 weeks 4 days" | "25 days"
304+
2+d|Rows: 1
327305
328306
|===
329307
@@ -336,38 +314,16 @@ RETURN format(d, "d 'days'") AS x
336314
[source, cypher, indent=0]
337315
----
338316
WITH duration({years: 1, months: 4, weeks: 3, days: 4, hours: 5, minutes: 6, seconds: 7, milliseconds: 8, microseconds: 9, nanoseconds: 10}) AS d
339-
RETURN format(d, "m 'minutes'") AS x
340-
----
341-
342-
.Result
343-
[role="queryresult",options="header,footer",cols="1*<m"]
344-
|===
345-
346-
| x
347-
| "306 minutes"
348-
1+d|Rows: 1
349-
350-
|===
351-
352-
======
353-
354-
.Duration formatting with hours and minutes converted to seconds
355-
======
356-
357-
.Query
358-
[source, cypher, indent=0]
359-
----
360-
WITH duration({years: 1, months: 4, weeks: 3, days: 4, hours: 5, minutes: 6, seconds: 7, milliseconds: 8, microseconds: 9, nanoseconds: 10}) AS d
361-
RETURN format(d, "s 'seconds' n 'millis'") AS x
317+
RETURN format(d, "m 'minutes' s 'seconds' N 'nanos'") AS withMinutes, format(d, "s 'seconds' N 'nanos'") AS withoutMinutes
362318
----
363319
364320
.Result
365-
[role="queryresult",options="header,footer",cols="1*<m"]
321+
[role="queryresult",options="header,footer",cols="2*<m"]
366322
|===
367323
368-
| x
369-
| "18367 seconds 8 millis"
370-
1+d|Rows: 1
324+
| withMinutes | withoutMinutes
325+
| "306 minutes 7 seconds 8009010 nanos" | "18367 seconds 8009010 nanos"
326+
2+d|Rows: 1
371327
372328
|===
373329

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)