During encoding in the spring of 12, I wrote a section about unified time format settings.Code: It can shield you from time format issues caused by different operating systems such as XP and win7. Today I want to use it again and find myself forgetting how to write the code, really despise yourself. This proves that it is only the first step to solve the problem and should be summarized in a timely manner, at least recorded.
Now, we can record the code that has been found by Google for a long time, so that you can find it later.
# Region added the global time format code at 15:09:08 by Anders Lu thread. currentthread. currentculture = (cultureinfo) thread. currentthread. currentculture. clone (); thread. currentthread. currentculture. datetimeformat. optional datepattern = "yyyy-mm-dd"; thread. currentthread. currentculture. datetimeformat. longdatepattern = "yyyy-mm-dd"; thread. currentthread. currentculture. datetimeformat. optional timepattern = "HH: mm: SS"; thread. currentthread. currentculture. datetimeformat. longtimepattern = "HH: mm: SS"; # endregion