File: Make_an_intersected_time_range.rst

package info (click to toggle)
python-datetimerange 2.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 476 kB
  • sloc: python: 1,891; makefile: 256; sh: 5
file content (14 lines) | stat: -rw-r--r-- 432 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Make an intersected time range
------------------------------
:Sample Code:
    .. code:: python

        from datetimerange import DateTimeRange
        time_range = DateTimeRange("2015-03-22T10:00:00+0900", "2015-03-22T10:10:00+0900")
        x = DateTimeRange("2015-03-22T10:05:00+0900", "2015-03-22T10:15:00+0900")
        time_range.intersection(x)

:Output:
    ::

        2015-03-22T10:05:00+0900 - 2015-03-22T10:10:00+0900