Skip to content

Commit 2e63438

Browse files
robsdedudedavidoliverSP2
authored andcommitted
Adding examples for Python's temporal types
1 parent 0f26c44 commit 2e63438

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

pythonManual/asciidoc/cypher-workflow.adoc

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,109 @@ include::{common-content}/cypher-workflow.adoc[tag=type-mapping]
129129
======
130130

131131

132+
[[python-driver-temporal-types]]
133+
=== Temporal Types
134+
135+
This section lists some basic usage of the temporal types provided by the Python Driver.
136+
137+
138+
[[python-driver-temporal-types-datetime]]
139+
==== `DateTime`
140+
141+
Represents an instant capturing the date, the time, and the timezone identifier.
142+
143+
[source, python]
144+
----
145+
include::{python-examples}/test_temporal_types_example.py[tags=temporal-types-datetime-import]
146+
----
147+
148+
[source, python]
149+
----
150+
include::{python-examples}/test_temporal_types_example.py[tags=temporal-types-datetime]
151+
----
152+
153+
154+
[[python-driver-temporal-types-date]]
155+
==== `Date`
156+
157+
Represents an instant capturing the date, but not the time, nor the timezone.
158+
159+
[source, python]
160+
----
161+
include::{python-examples}/test_temporal_types_example.py[tags=temporal-types-date-import]
162+
----
163+
164+
[source, python]
165+
----
166+
include::{python-examples}/test_temporal_types_example.py[tags=temporal-types-date]
167+
----
168+
169+
170+
[[python-driver-temporal-types-time]]
171+
==== `Time`
172+
173+
Represents an instant capturing the time of day, and the timezone offset in seconds, but not the date.
174+
175+
[source, python]
176+
----
177+
include::{python-examples}/test_temporal_types_example.py[tags=temporal-types-time-import]
178+
----
179+
180+
[source, python]
181+
----
182+
include::{python-examples}/test_temporal_types_example.py[tags=temporal-types-time]
183+
----
184+
185+
186+
[[python-driver-temporal-types-local-datetime]]
187+
==== `Local DateTime`
188+
189+
Represents an instant capturing the date and the time, but not the timezone.
190+
191+
[source, python]
192+
----
193+
include::{python-examples}/test_temporal_types_example.py[tags=temporal-types-local-datetime-import]
194+
----
195+
196+
[source, python]
197+
----
198+
include::{python-examples}/test_temporal_types_example.py[tags=temporal-types-local-datetime]
199+
----
200+
201+
202+
[[python-driver-temporal-types-local-time]]
203+
==== `Local Time`
204+
205+
Represents an instant capturing the time of day, but not the date, nor the timezone.
206+
207+
[source, python]
208+
----
209+
include::{python-examples}/test_temporal_types_example.py[tags=temporal-types-local-time-import]
210+
----
211+
212+
[source, python]
213+
----
214+
include::{python-examples}/test_temporal_types_example.py[tags=temporal-types-local-time]
215+
----
216+
217+
218+
[[python-driver-temporal-types-duration]]
219+
==== `Duration`
220+
221+
Represents an ISO 8601 duration.
222+
Contains both date-based values (years, months, days) and time-based values (seconds, nanoseconds).
223+
224+
[source, python]
225+
----
226+
include::{python-examples}/test_temporal_types_example.py[tags=temporal-types-duration-import]
227+
----
228+
229+
[source, python]
230+
----
231+
include::{python-examples}/test_temporal_types_example.py[tags=temporal-types-duration]
232+
----
233+
234+
132235
[[python-driver-exceptions-errors]]
133236
== Exceptions and error handling
134237

0 commit comments

Comments
 (0)