标签:col isp alt efault view 问题 short event adc
System.Globalization.CultureInfo.CurrentCulture = new System.Globalization.CultureInfo("zh-CN", true) { DateTimeFormat = { ShortDatePattern = "yyyy-MM-dd", FullDateTimePattern = "yyyy-MM-dd HH:mm:ss", LongTimePattern = "HH:mm:ss" } }; System.Globalization.CultureInfo.CurrentUICulture = new System.Globalization.CultureInfo("zh-CN", true) { DateTimeFormat = { ShortDatePattern = "yyyy-MM-dd", FullDateTimePattern = "yyyy-MM-dd HH:mm:ss", LongTimePattern = "HH:mm:ss" } }; System.Globalization.CultureInfo.DefaultThreadCurrentCulture = new System.Globalization.CultureInfo("zh-CN", true) { DateTimeFormat = { ShortDatePattern = "yyyy-MM-dd", FullDateTimePattern = "yyyy-MM-dd HH:mm:ss", LongTimePattern = "HH:mm:ss" } }; System.Globalization.CultureInfo.DefaultThreadCurrentUICulture = new System.Globalization.CultureInfo("zh-CN", true) { DateTimeFormat = { ShortDatePattern = "yyyy-MM-dd", FullDateTimePattern = "yyyy-MM-dd HH:mm:ss", LongTimePattern = "HH:mm:ss" } };
.net core 默认编码格式没注意,时间类型 直接默认字符串的话:月/日 年 时:分:秒,一般会和我们的用法不一致。(tostring("yyyy-MM-dd HH:mm:ss"),则是重新制定format,就不受制于编码了)
上述代码,适用于全局。
写在program中的第一行。
标签:col isp alt efault view 问题 short event adc
原文地址:https://www.cnblogs.com/ericli-ericli/p/9100379.html