I am using the following format to convert a DateTime to a string
setting.SettingValue = dt.ToString( "yyyy-MM-dd HH:mm:ss.fff" );
however the value is not as expected. The SettingValue
property contains this value
2014-01-07 23.14.59.000
which uses a different time separator ( .
) instead of the specified one ( :
)
Any help?
You haven't specified a format provider, so it's using the one from the current culture. If you always want to use :
, you should specify an appropriate provider, eg:
setting.SettingValue = dt.ToString("yyyy-MM-dd HH:mm:ss.fff",
CultureInfo.InvariantCulture);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.