Skip to content

Commit dfda184

Browse files
committed
Merge branch 'master' of https://github.com/sudoscrawl/pendulum
2 parents a327c13 + 23a7a45 commit dfda184

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

docs/docs/parsing.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The library natively supports the RFC 3339 format, most ISO 8601 formats and som
77

88
>>> dt = pendulum.parse('1975-05-21T22:00:00')
99
>>> print(dt)
10-
'1975-05-21T22:00:00+00:00
10+
'1975-05-21T22:00:00+00:00'
1111

1212
# You can pass a tz keyword to specify the timezone
1313
>>> dt = pendulum.parse('1975-05-21T22:00:00', tz='Europe/Paris')
@@ -112,3 +112,21 @@ When passing only time information the date will default to today.
112112
>>> pendulum.parse('12:04:23', exact=True)
113113
Time(12, 04, 23)
114114
```
115+
### Strict parsing helpers
116+
117+
Pendulum also provides helper functions for strict parsing of specific types:
118+
119+
```python
120+
>>> import pendulum
121+
122+
>>> pendulum.parse_datetime("2016-10-16T12:34:56")
123+
DateTime(...)
124+
125+
>>> pendulum.parse_date("2016-10-16")
126+
Date(2016, 10, 16)
127+
128+
>>> pendulum.parse_time("12:34:56")
129+
Time(12, 34, 56)
130+
131+
>>> pendulum.parse_duration("PT2H")
132+
Duration(...)

0 commit comments

Comments
 (0)