This document describes an older version of Celery (2.5). For the latest stable version please go here.
This module contains various utilities relating to dates and times.
copyright: |
|
---|---|
license: | BSD, see LICENSE for more details. |
No specification exists for the timezone specified. Consider installing the pytz library to get access to more timezones.
Round a datetime to the resolution of a timedelta.
If the timedelta is in days, the datetime will be rounded to the nearest days, if the timedelta is in hours the datetime will be rounded to the nearest hour, and so on until seconds which will just return the original datetime.
Show seconds in human form, e.g. 60 is “1 minute”, 7200 is “2 hours”.
Either datetime | str -> datetime or None -> None
Coerces integer to timedelta if delta is an integer.
Parses rate strings, such as “100/m” or “2/h” and converts them to seconds.
Calculate the remaining time for a start date and a timedelta.
e.g. “how many seconds left for 30 seconds after start?”
Parameters: |
|
---|
Convert datetime.timedelta to seconds.
Doesn’t account for negative values.
Return the position of a weekday (0 - 7, where 0 is Sunday).
Example:
>>> weekday("sunday"), weekday("sun"), weekday("mon")
(0, 0, 1)