Python django.utils.formats.time_format() Examples

The following are 8 code examples of django.utils.formats.time_format(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module django.utils.formats , or try the search function .
Example #1
Source File: defaultfilters.py    From GTDWeb with GNU General Public License v2.0 5 votes vote down vote up
def time(value, arg=None):
    """Formats a time according to the given format."""
    if value in (None, ''):
        return ''
    if arg is None:
        arg = settings.TIME_FORMAT
    try:
        return formats.time_format(value, arg)
    except AttributeError:
        try:
            return time_format(value, arg)
        except AttributeError:
            return '' 
Example #2
Source File: defaultfilters.py    From bioforum with MIT License 5 votes vote down vote up
def time(value, arg=None):
    """Format a time according to the given format."""
    if value in (None, ''):
        return ''
    try:
        return formats.time_format(value, arg)
    except (AttributeError, TypeError):
        try:
            return time_format(value, arg)
        except (AttributeError, TypeError):
            return '' 
Example #3
Source File: defaultfilters.py    From Hands-On-Application-Development-with-PyCharm with MIT License 5 votes vote down vote up
def time(value, arg=None):
    """Format a time according to the given format."""
    if value in (None, ''):
        return ''
    try:
        return formats.time_format(value, arg)
    except (AttributeError, TypeError):
        try:
            return time_format(value, arg)
        except (AttributeError, TypeError):
            return '' 
Example #4
Source File: defaultfilters.py    From python with Apache License 2.0 5 votes vote down vote up
def time(value, arg=None):
    """Formats a time according to the given format."""
    if value in (None, ''):
        return ''
    try:
        return formats.time_format(value, arg)
    except (AttributeError, TypeError):
        try:
            return time_format(value, arg)
        except (AttributeError, TypeError):
            return '' 
Example #5
Source File: defaultfilters.py    From luscan-devel with GNU General Public License v2.0 5 votes vote down vote up
def time(value, arg=None):
    """Formats a time according to the given format."""
    if value in (None, ''):
        return ''
    if arg is None:
        arg = settings.TIME_FORMAT
    try:
        return formats.time_format(value, arg)
    except AttributeError:
        try:
            return time_format(value, arg)
        except AttributeError:
            return '' 
Example #6
Source File: defaultfilters.py    From openhgsenti with Apache License 2.0 5 votes vote down vote up
def time(value, arg=None):
    """Formats a time according to the given format."""
    if value in (None, ''):
        return ''
    if arg is None:
        arg = settings.TIME_FORMAT
    try:
        return formats.time_format(value, arg)
    except AttributeError:
        try:
            return time_format(value, arg)
        except AttributeError:
            return '' 
Example #7
Source File: defaultfilters.py    From python2017 with MIT License 5 votes vote down vote up
def time(value, arg=None):
    """Formats a time according to the given format."""
    if value in (None, ''):
        return ''
    try:
        return formats.time_format(value, arg)
    except (AttributeError, TypeError):
        try:
            return time_format(value, arg)
        except (AttributeError, TypeError):
            return '' 
Example #8
Source File: telltime.py    From ls.joyous with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def _timeFormat(when, formatStr):
    """
    Format a single time, e.g. 10am
    """
    if formatStr:
        retval = _Formatter(when).format(formatStr)
    else:
        retval = formats.time_format(when)
    return retval