webhelpers2.date

Date and time helpers.

webhelpers2.date.distance_of_time_in_words(from_time, to_time=0, granularity='second', round=False)

Return the absolute time-distance string for two datetime objects, ints or any combination you can dream of.

If times are integers, they are interpreted as seconds from now.

granularity dictates where the string calculation is stopped. If set to seconds (default) you will receive the full string. If another accuracy is supplied you will receive an approximation. Available granularities are: 'century', 'decade', 'year', 'month', 'day', 'hour', 'minute', 'second'

Setting round to true will increase the result by 1 if the fractional value is greater than 50% of the granularity unit.

webhelpers2.date.time_ago_in_words(from_time, granularity='second', round=False)

Return approximate-time-distance string for from_time till now.

Same as distance_of_time_in_words but the endpoint is now.

Previous topic

webhelpers2.containers

Next topic

webhelpers2.html