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;
        }
    }

转载于:https://www.cnblogs.com/FLWL/p/6008113.html

你可能感兴趣的:(C#中格式化获取到的当前系统时间的各种格式)