(context, format_string='L LT')
return format_string
Return a datetime format string for momentjs, with support for 24 hour time
    override setting.
    :param context: caller context data
    :param format_string: the default format string (locale based)
    :return: the format string to use, as 24 hour time if configured.
Return a datetime format string for momentjs, with support for 24 hour time
    override setting.
    :param context: caller context data
    :param format_string: the default format string (locale based)
    :return: the format string to use, as 24 hour time if configured.
Return a datetime format string for momentjs with support for 24 hour time override setting . : param context : caller context data : param format_string : the default format string ( locale based ) : return : the format string to use as 24 hour time if configured .
def datetimepicker_format(context, format_string='L LT'):
    """
    Return a datetime format string for momentjs, with support for 24 hour time
    override setting.
    :param context: caller context data
    :param format_string: the default format string (locale based)
    :return: the format string to use, as 24 hour time if configured.
    """
    try:
        user = context['request'].user
        if hasattr(user, 'settings') and user.settings.language:
            language = user.settings.language
        else:
            language = settings.LANGUAGE_CODE
    except KeyError:
        language = None

    if settings.USE_24_HOUR_TIME_FORMAT:
        if format_string == 'L LT':
            format_string = 'L HH:mm'
        elif format_string == 'L LTS':
            format_string = 'L HH:mm:ss'
    elif language and language == 'en-GB':
        # Force 12-hour format if 24 hour format is not configured for en-GB
        # (Django default is 12H, momentjs default is 24H).
        if format_string == 'L LT':
            format_string = 'L h:mm a'
        elif format_string == 'L LTS':
            format_string = 'L h:mm:ss a'

    return format_string
def datetimepicker_format ( context , format_string = 'L LT' ) : try : user = context [ 'request' ] . user if hasattr ( user , 'settings' ) and user . settings . language : language = user . settings . language else : language = settings . LANGUAGE_CODE except KeyError : language = None if settings . USE_24_HOUR_TIME_FORMAT : if format_string == 'L LT' : format_string = 'L HH:mm' elif format_string == 'L LTS' : format_string = 'L HH:mm:ss' elif language and language == 'en-GB' : # Force 12-hour format if 24 hour format is not configured for en-GB # (Django default is 12H, momentjs default is 24H). if format_string == 'L LT' : format_string = 'L h:mm a' elif format_string == 'L LTS' : format_string = 'L h:mm:ss a' return format_string