@@ -152,7 +152,7 @@ More characters will result in an error.
152152
153153|===
154154
155- .Formatting with year, month, day, hour, minute, second, fraction-of-second and zone-offset
155+ .Instance formatting with year, month, day, hour, minute, second, fraction-of-second and zone-offset
156156======
157157
158158.Query
@@ -174,7 +174,7 @@ RETURN format(dt, "yyyy-MM-dd'T'HH:mm:ss.SSSZ") AS x
174174
175175======
176176
177- .Formatting with day-of-week, month-of-year, day-of-month, era and year
177+ .Instance formatting with day-of-week, month-of-year, day-of-month, era and year
178178======
179179
180180.Query
@@ -198,7 +198,7 @@ Four occurrences of `E` and `M` (text presentations) output the full form of the
198198
199199======
200200
201- .Formatting with day-of-year and localized day-of-week
201+ .Instance formatting with day-of-year and localized day-of-week
202202======
203203
204204.Query
@@ -220,7 +220,7 @@ RETURN format(dt, "DDD'th day of the year,' c'rd day of the week'") AS x
220220
221221======
222222
223- .Formatting with day-of-year and localized day-of-week
223+ .Instance formatting with day-of-year and localized day-of-week
224224======
225225
226226.Query
@@ -242,7 +242,7 @@ RETURN format(dt, "DDD'th day of the year,' c'rd day of the week'") AS x
242242
243243======
244244
245- .Formatting with clock-hour-of-day (1-24), minute-of-hour and time-zone name
245+ .Instance formatting with clock-hour-of-day (1-24), minute-of-hour and time-zone name
246246======
247247
248248.Query
@@ -264,7 +264,7 @@ RETURN format(dt, "k:mm z") AS x
264264
265265======
266266
267- .Formatting with hour-of-am-pm (0-11), minute-of-hour and localized zone-offset
267+ .Instance formatting with hour-of-am-pm (0-11), minute-of-hour and localized zone-offset
268268======
269269
270270.Query
@@ -286,7 +286,7 @@ RETURN format(dt, "K:mm O") AS x
286286
287287======
288288
289- .Formatting with month-of-year, day-of-month, milli-of-day, minute-of-hour and second-of-minute
289+ .Instance formatting with month-of-year, day-of-month, milli-of-day, minute-of-hour and second-of-minute
290290======
291291
292292.Query
@@ -310,7 +310,7 @@ Three occurrences of `L` (number/text presentation) output the short form ("Nov"
310310
311311======
312312
313- .Formatting with nano-of-second and nano-of-day
313+ .Instance formatting with nano-of-second and nano-of-day
314314======
315315
316316.Query
@@ -332,7 +332,7 @@ RETURN format(dt, "'Nano of second: 'n', nano of day: 'N") AS x
332332
333333======
334334
335- .Formatting with quarter-of-year and year-of-era
335+ .Instance formatting with quarter-of-year and year-of-era
336336======
337337
338338.Query
@@ -354,7 +354,7 @@ RETURN format(dt, "QQQQ' of 'yyyy") AS x
354354
355355======
356356
357- .Formatting with pad next and week-based-year
357+ .Instance formatting with pad next and week-based-year
358358======
359359
360360.Query
@@ -393,36 +393,123 @@ Use the characters in table <<duration-character-table>> to create a string patt
393393.Allowed characters for a duration type string pattern
394394[options="header"]
395395|===
396- | Component Group | Characters | Field
397- | Months | y/Y/u | Years
398- | | q/Q | Quarters
399- | | M/L | Months
400- | Days | w/W | Weeks
401- | | d/D | Days
402- | Seconds | h/H/k/K | Hours
403- | | m | Minutes
404- | | s | Seconds
405- | | n/S | Fraction of Second
406- | | A | Milliseconds
407- | | N | Nanoseconds
408- |===
409-
410- .awesome example
396+ | Component Group | Characters | Presentation
397+ | Months | y/Y/u | years
398+ | | q/Q | quarters
399+ | | M/L | months
400+ | Days | w/W | weeks
401+ | | d/D | days
402+ | Seconds | h/H/k/K | hours
403+ | | m | minutes
404+ | | s | seconds
405+ | | n/S | fraction-of-second
406+ | | A | milliseconds
407+ | | N | nanoseconds
408+ |===
409+
410+ .Duration formatting
411411======
412412
413413.Query
414414[source, cypher, indent=0]
415415----
416- WITH datetime('2024-06-27T14:30:45.123456789+02:00[Europe/Paris]') AS dt
417- RETURN format(dt, "yyyy-MM-dd'T'HH:mm:ss.SSSZ") AS x
416+ WITH duration({years: 1, months: 4, weeks: 3, days: 4, hours: 5, minutes: 6, seconds: 7, milliseconds: 8, microseconds: 9, nanoseconds: 10}) AS d
417+ RETURN format(d, "y 'years' q 'quarters' M 'months' w 'weeks' d 'days' h 'hours' m 'minutes' s 'seconds' N 'nanos'") AS x
418+ ----
419+
420+ .Result
421+ [role="queryresult",options="header,footer",cols="1*<m"]
422+ |===
423+
424+ | x
425+ | "1 years 1 quarters 1 months 3 weeks 4 days 5 hours 6 minutes 7 seconds 8009010 nanos"
426+ 1+d|Rows: 1
427+
428+ |===
429+ ======
430+
431+ .Duration formatting with years converted to quarters
432+ ======
433+
434+ .Query
435+ [source, cypher, indent=0]
436+ ----
437+ WITH duration({years: 1, months: 4, weeks: 3, days: 4, hours: 5, minutes: 6, seconds: 7, milliseconds: 8, microseconds: 9, nanoseconds: 10}) AS d
438+ RETURN format(d, "q 'quarters' M 'months'") AS x
439+ ----
440+
441+ .Result
442+ [role="queryresult",options="header,footer",cols="1*<m"]
443+ |===
444+
445+ | x
446+ | "5 quarters 1 months"
447+ 1+d|Rows: 1
448+
449+ |===
450+
451+ ======
452+
453+ .Duration formatting with weeks converted to days
454+ ======
455+
456+ .Query
457+ [source, cypher, indent=0]
458+ ----
459+ WITH duration({years: 1, months: 4, weeks: 3, days: 4, hours: 5, minutes: 6, seconds: 7, milliseconds: 8, microseconds: 9, nanoseconds: 10}) AS d
460+ RETURN format(d, "d 'days'") AS x
461+ ----
462+
463+ .Result
464+ [role="queryresult",options="header,footer",cols="1*<m"]
465+ |===
466+
467+ | x
468+ | "25 days"
469+ 1+d|Rows: 1
470+
471+ |===
472+
473+ ======
474+
475+ .Duration formatting with hours converted to minutes
476+ ======
477+
478+ .Query
479+ [source, cypher, indent=0]
480+ ----
481+ WITH duration({years: 1, months: 4, weeks: 3, days: 4, hours: 5, minutes: 6, seconds: 7, milliseconds: 8, microseconds: 9, nanoseconds: 10}) AS d
482+ RETURN format(d, "m 'minutes'") AS x
483+ ----
484+
485+ .Result
486+ [role="queryresult",options="header,footer",cols="1*<m"]
487+ |===
488+
489+ | x
490+ | "306 minutes"
491+ 1+d|Rows: 1
492+
493+ |===
494+
495+ ======
496+
497+ .Duration formatting with hours and minutes converted to seconds
498+ ======
499+
500+ .Query
501+ [source, cypher, indent=0]
502+ ----
503+ WITH duration({years: 1, months: 4, weeks: 3, days: 4, hours: 5, minutes: 6, seconds: 7, milliseconds: 8, microseconds: 9, nanoseconds: 10}) AS d
504+ RETURN format(d, "s 'seconds' n 'millis'") AS x
418505----
419506
420507.Result
421508[role="queryresult",options="header,footer",cols="1*<m"]
422509|===
423510
424511| x
425- | "2024-06-27T14:30:45.123+0200 "
512+ | "18367 seconds 8 millis "
4265131+d|Rows: 1
427514
428515|===
0 commit comments