This allow you to offset date / time with a string.
Example
d = DateOffset() tomorrow = d.get_offset("1d") yesterday = d.get_offset("-1d")
- # start of week (Monday)
- * end of week
- % first day of the month
- d offset by days (1d)
- w offset by weeks (1w)
- m offset by months (1m)
- y offset by years (1y)
- ~ not weekend
- s offset by seconds (3600s)
- i offset by minutes (60m)
- h offset by hours (1h)
- t time (10t = 10hr. 10:15t = 10hr 15mins. 10:15:45t = 10hr 15mins 45secs)
If you want to include time in your output the include_time must be set.
d = DateOffset() one_hours_time = d.get_offset("1h", include_time=True)
Nested string can be used
d = DateOffset() second_day_of_current_month = d.get_offset("%1d")