"""Wrapper class providing the various date and number formatting functions
bound to a specific locale and time-zone.
+ >>> from babel.util import UTC
+ >>> from datetime import date
>>> fmt = Format('en_US', UTC)
>>> fmt.date(date(2007, 4, 1))
u'Apr 1, 2007'
def date(self, date=None, format='medium'):
"""Return a date formatted according to the given pattern.
+ >>> from datetime import date
>>> fmt = Format('en_US')
>>> fmt.date(date(2007, 4, 1))
u'Apr 1, 2007'
def datetime(self, datetime=None, format='medium'):
"""Return a date and time formatted according to the given pattern.
+ >>> from datetime import datetime
>>> from pytz import timezone
>>> fmt = Format('en_US', tzinfo=timezone('US/Eastern'))
>>> fmt.datetime(datetime(2007, 4, 1, 15, 30))
def time(self, time=None, format='medium'):
"""Return a time formatted according to the given pattern.
+ >>> from datetime import datetime
>>> from pytz import timezone
>>> fmt = Format('en_US', tzinfo=timezone('US/Eastern'))
>>> fmt.time(datetime(2007, 4, 1, 15, 30))
format='medium', add_direction=False):
"""Return a time delta according to the rules of the given locale.
+ >>> from datetime import timedelta
>>> fmt = Format('en_US')
>>> fmt.timedelta(timedelta(weeks=11))
u'3 months'