C#中格式化获取到的当前系统时间的各种格式

    public class CustomLanguage : CultureInfo
    {
        public CustomLanguage(string shortDatePattern = "yyyy-MM-dd", string longDatePattern = "yyyy-MM-dd", string shortTimePattern = "HH:mm:ss", string longTimePattern = "HH:mm:ss")
            : base(InvariantCulture.LCID, true)
        {

            DateTimeFormat = (DateTimeFormatInfo)InstalledUICulture.DateTimeFormat.Clone();


            DateTimeFormat.LongDatePattern = longDatePattern;
            DateTimeFormat.ShortDatePattern = shortDatePattern;
            DateTimeFormat.LongTimePattern = longTimePattern;
            DateTimeFormat.ShortTimePattern = shortTimePattern;
            DateTimeFormat.AMDesignator = string.Empty;
        }
    }

posted on 2016-10-28 15:45  连一粝  阅读(383)  评论(0编辑  收藏  举报

导航