File: Move_the_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 (16 lines) | stat: -rw-r--r-- 490 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Move the time range
-------------------
:Sample Code:
    .. code:: python

        import datetime
        from datetimerange import DateTimeRange
        value = DateTimeRange("2015-03-22T10:10:00+0900", "2015-03-22T10:20:00+0900")
        print(value + datetime.timedelta(seconds=10 * 60))
        print(value - datetime.timedelta(seconds=10 * 60))

:Output:
    ::

        2015-03-22T10:20:00+0900 - 2015-03-22T10:30:00+0900
        2015-03-22T10:00:00+0900 - 2015-03-22T10:10:00+0900