@@ -56,6 +56,10 @@ now+1w/w 2016-01-11T00:00:00+00:00
56
56
now/d+7d+12h 2016-01-08T12:00:00+00:00
57
57
2016-01-01||+1d 2016-01-02T00:00:00+00:00
58
58
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
+
59
63
```
60
64
61
65
# Usage
@@ -84,7 +88,7 @@ By default datemath return an arrow date object representing your timestamp.
84
88
85
89
If you would rather have a string, you can use arrow's ``` .format() ``` method.
86
90
> For for info on string formatting, check out arrows tokens section: http://crsmithdev.com/arrow/#tokens
87
- ``` python
91
+ ```
88
92
>>> from datemath import dm
89
93
>>>
90
94
>>> src_timestamp = dm('2016-01-01')
@@ -101,7 +105,7 @@ u'2015.12.18'
101
105
```
102
106
103
107
Rather have a python datetime object instead? Just pass along the 'datetime' type
104
- ``` python
108
+ ```
105
109
from datemath import dm
106
110
>>> dm('now', type='datetime')
107
111
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.
115
119
1453676321
116
120
```
117
121
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
+
118
136
# What timezone are my objects in?
119
137
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.
120
138
Timezone list can be found here: https://gist.github.com/pamelafox/986163
121
- ``` python
139
+ ```
122
140
from datemath import dm
123
141
>>> dm('now')
124
142
<Arrow [2016-01-26T01:00:53.601088+00:00]>
0 commit comments