diff options
author | David Lehrian <david@lehrian.com> | 2014-12-28 13:25:07 -0800 |
---|---|---|
committer | David Lehrian <david@lehrian.com> | 2014-12-28 13:25:07 -0800 |
commit | 15ce30cd6e49d5d2dc88f8469139b12c61d48740 (patch) | |
tree | f041df7680fa23e52fb169bce9b09a0814f579a5 /docs/examples.rst | |
parent | ada102f41635ec74518b29a8635081d25318125e (diff) | |
download | dateutil-15ce30cd6e49d5d2dc88f8469139b12c61d48740.tar.gz |
Document absolute vs relative relativedelta
Better document difference between adding a relativedelta initialized
with absolute (singular) vs relative (plural) arguments.
Diffstat (limited to 'docs/examples.rst')
-rw-r--r-- | docs/examples.rst | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/examples.rst b/docs/examples.rst index 815e457..ce52c63 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -48,6 +48,15 @@ Next month, plus one week, at 10am. >>> TODAY+relativedelta(months=+1, weeks=+1, hour=10) datetime.datetime(2003, 10, 24, 10, 0) +Here is another example using an absolute relativedelta. Notice the use of +year and month (both singular) which causes the values to be *replaced* in the +original datetime rather than performing an arithmetic operation on them. + +.. doctest:: relativedelta + + >>> NOW+relativedelta(year=1, month=1) + datetime(1, 1, 17, 20, 54, 47, 282310) + Let's try the other way around. Notice that the hour setting we get in the relativedelta is relative, since it's a difference, and the weeks parameter |