Skip to content

Commit 37c6bc2

Browse files
committed
README update
1 parent 340f4bb commit 37c6bc2

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ now+1w/w 2016-01-11T00:00:00+00:00
5656
now/d+7d+12h 2016-01-08T12:00:00+00:00
5757
2016-01-01||+1d 2016-01-02T00:00:00+00:00
5858
2015-01-01||+2w 2015-01-15T00:00:00+00:00
59+
60+
# Using the roundDown=False option
61+
now/d 2016-01-01T23:59:59+00:00
62+
5963
```
6064

6165
# Usage
@@ -84,7 +88,7 @@ By default datemath return an arrow date object representing your timestamp.
8488

8589
If you would rather have a string, you can use arrow's ```.format()``` method.
8690
> For for info on string formatting, check out arrows tokens section: http://crsmithdev.com/arrow/#tokens
87-
```python
91+
```
8892
>>> from datemath import dm
8993
>>>
9094
>>> src_timestamp = dm('2016-01-01')
@@ -101,7 +105,7 @@ u'2015.12.18'
101105
```
102106

103107
Rather have a python datetime object instead? Just pass along the 'datetime' type
104-
```python
108+
```
105109
from datemath import dm
106110
>>> dm('now', type='datetime')
107111
datetime.datetime(2016, 1, 22, 22, 58, 28, 338060, tzinfo=tzutc())
@@ -115,10 +119,24 @@ Oh, you want an Epoch/Unix Timestamp back instead? Yeah, we can do that.
115119
1453676321
116120
```
117121

122+
Or you can just import the `datamath` module, this will always give us a native `datetime` object
123+
```
124+
>>> from datemath import datemath
125+
>>>
126+
>>> datemath('2016-01-01T16:20:00||/d', roundDown=False)
127+
datetime.datetime(2016, 1, 1, 23, 59, 59, 999999, tzinfo=tzutc())
128+
>>>
129+
>>>
130+
>>> # roundDown=True is default and implied
131+
>>> datemath('2016-01-01T16:20:00||/d')
132+
datetime.datetime(2016, 1, 1, 0, 0, tzinfo=tzutc())
133+
>>>
134+
```
135+
118136
# What timezone are my objects in?
119137
By default all objects returned by datemath are in UTC. If you want them them in a different timezone, just pass along the ```tz``` argument.
120138
Timezone list can be found here: https://gist.github.com/pamelafox/986163
121-
```python
139+
```
122140
from datemath import dm
123141
>>> dm('now')
124142
<Arrow [2016-01-26T01:00:53.601088+00:00]>

0 commit comments

Comments
 (0)