cultureinfo - C# DateTime conversion same culture on different machines -
if run console app test italian machine:
static void main(string[] args) { string date = datetime.now.tostring("yyyy-mm-dd hh:mm", new cultureinfo("it-it")); console.writeline(date); console.readkey(); cultureinfo ci = new cultureinfo("it-it"); console.writeline("time: " + ci.name + " " + ci.datetimeformat.timeseparator); console.writeline("date: " + ci.name + " " + ci.datetimeformat.dateseparator); console.readkey(); }
displays:
2013-07-25 15:40 time: it-it : date: it-it /
but if run code usa server:
2013-07-25 15.40 time: it-it . date: it-it /
why different format separator time part? correct 1 italian must :
you found out data time separator italian changed between versions of windows (colon more up-to-date version). expected improving our data. if found because of transferring data between machines, should using standard invariant formats (like iso 8601) immune data changes.
Comments
Post a Comment