Esempio n. 1
0
        /// <summary>
        /// Date filter which is aware of locale settings for date formats.
        /// </summary>
        /// <param name="input"></param>
        /// <param name="format"></param>
        /// <returns></returns>
        public static string Date(object input, string format)
        {
            if (!String.IsNullOrEmpty(format))
            {
                var loc       = String.Format("date_formats.{0}", format);
                var newFormat = TranslationFilter.T(loc);
                if (newFormat != loc)
                {
                    format = newFormat;
                }

                if (format == "long")
                {
                    format = "%d %b %Y %X";
                }
            }

            return(StandardFilters.Date(input, format));
        }
Esempio n. 2
0
        /// <summary>
        /// Date filter which is aware of locale settings for date formats.
        /// </summary>
        /// <param name="input"></param>
        /// <param name="format"></param>
        /// <returns></returns>
        public static string Date(object input, string format)
        {
            if (!String.IsNullOrEmpty(format) && !format.Contains("%")) // special formats that can be defined in settings
            {
                var loc       = String.Format("date_formats.{0}", format);
                var newFormat = TranslationFilter.T(loc);
                if (newFormat != loc)
                {
                    format = newFormat;
                }

                if (format == "long")
                {
                    format = "%d %b %Y %X";
                }
            }

            return(StandardFilters.Date(input, format));
        }