File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff 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(... )
You can’t perform that action at this time.
0 commit comments