Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(202)  |  Call(128)  |  Derive(0)  |  Import(74)
Return a date formatted according to the given pattern.

>>> d = date(2007, 04, 01)
>>> format_date(d, locale='en_US')
u'Apr 1, 2007'
>>> format_date(d, format='full', locale='de_DE')
u'Sonntag, 1. April 2007'

If you don't want to use the locale default formats, you can specify a
custom date pattern:(more...)

        def format_date(date=None, format='medium', locale=LC_TIME):
    """Return a date formatted according to the given pattern.
    
    >>> d = date(2007, 04, 01)
    >>> format_date(d, locale='en_US')
    u'Apr 1, 2007'
    >>> format_date(d, format='full', locale='de_DE')
    u'Sonntag, 1. April 2007'
    
    If you don't want to use the locale default formats, you can specify a
    custom date pattern:
    
    >>> format_date(d, "EEE, MMM d, ''yy", locale='en')
    u"Sun, Apr 1, '07"
    
    :param date: the ``date`` or ``datetime`` object; if `None`, the current
                 date is used
    :param format: one of "full", "long", "medium", or "short", or a custom
                   date/time pattern
    :param locale: a `Locale` object or a locale identifier
    :rtype: `unicode`
    
    :note: If the pattern contains time fields, an `AttributeError` will be
           raised when trying to apply the formatting. This is also true if
           the value of ``date`` parameter is actually a ``datetime`` object,
           as this function automatically converts that to a ``date``.
    """
    if date is None:
        date = date_.today()
    elif isinstance(date, datetime):
        date = date.date()

    locale = Locale.parse(locale)
    if format in ('full', 'long', 'medium', 'short'):
        format = get_date_format(format, locale=locale)
    pattern = parse_pattern(format)
    return pattern.apply(date, locale)
        


src/w/e/webapp2_example-HEAD/lib/webapp2_extras/i18n.py   webapp2_example(Download)
            date = self.to_local_timezone(date)
 
        return dates.format_date(date, format, locale=self.locale)
 
    def format_datetime(self, datetime=None, format=None, rebase=True):

src/r/e/reahl-doc-2.1.0/reahl/doc/examples/tutorial/i18nexample/i18nexample.py   reahl-doc(Download)
    def __init__(self, view, address):
        super(AddressBox, self).__init__(view)
        formatted_date = babel.dates.format_date(address.added_date, locale=_.current_locale)
        self.add_child(P(view, text=u'%s: %s (%s)' % (address.name, address.email_address, formatted_date)))
 

src/v/e/veil-HEAD/src/veil/frontend/locale/l10n.py   veil(Download)
    if isinstance(date_to_show, datetime.datetime):
        date_to_show = convert_datetime_to_client_timezone(date_to_show)
    return babel.dates.format_date(date=date_to_show, format=format, locale=get_current_locale())
 
 

src/k/a/KalaPy-0.4.2/kalapy/i18n/format.py   KalaPy(Download)
    :returns: formated date as string
    """
    return dates.format_date(date, format=format, locale=get_locale())
 
 

src/v/o/voteit.core-HEAD/voteit/core/models/date_time_util.py   voteit.core(Download)
from datetime import datetime
 
import pytz
from babel.dates import format_date
from babel.dates import format_time
        """
        localtime = self.utc_to_tz(value)
        return format_date(localtime, format=format, locale=self.locale)
 
    def t_format(self, value, format='short'):

src/k/a/kalapy-HEAD/kalapy/i18n/format.py   kalapy(Download)
    :returns: formated date as string
    """
    return dates.format_date(date, format=format, locale=get_locale())
 
 

src/f/o/Formular-0.2/formular/fields.py   Formular(Download)
 
try:
    from babel.dates import format_time, parse_time, format_date, parse_date
    HAS_BABEL = True
except ImportError:
        def to_primitive(self, value):
            if not isinstance(value, date):
                return u""
            return format_date(value, format=self.format,
                locale=self.form.translations.locale

src/a/d/adhocracy-2.4.1/src/adhocracy/publixphere_theme/i18n/__init__.py   adhocracy(Download)
    if set_timezone:
        dt = local_datetime(dt)
    return babel.dates.format_date(dt, format='long', locale=c.locale or
                                   babel.Locale('en', 'US'))
 

src/a/d/adhocracy-2.4.1/parts/omelette/adhocracy/i18n/__init__.py   adhocracy(Download)
    if set_timezone:
        dt = local_datetime(dt)
    return babel.dates.format_date(dt, format=format, locale=c.locale or
                                   babel.Locale('en', 'US'))
 

src/a/d/adhocracy-2.4.1/src/adhocracy/i18n/__init__.py   adhocracy(Download)
    if set_timezone:
        dt = local_datetime(dt)
    return babel.dates.format_date(dt, format=format, locale=c.locale or
                                   babel.Locale('en', 'US'))
 

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next