I would like to write a method that gives me 3 letters - representing day, month, year - from datetimeformat.
So, in en-US culture, my desired return values ββwill be (plus a separator)
in de-DE the same method should return
- T ( T ag = day)
- M ( M onat = month)
- J ( J ahr = year)
- . (Separator)
I looked at the DateTimeFormatInfo class of CurrentCulture , but could only find the delimiter. Do you know how I can get the rest?
var culture = Thread.CurrentThread.CurrentCulture; Console.WriteLine(culture.DateTimeFormat.DateSeparator);
I need this because the TEXT function inside Excel does not accept the format from the InvariantCulture and only processes it from the current culture.
So something like this is not valid in the German version of Excel:
=TEXT(NOW();"dd.MM.yyyy")
it needs to be installed using
=TEXT(NOW();"TT.MM.JJJJ")
(it doesnβt matter if this is done with VBA, it does not translate) You can see the following http://www.rondebruin.nl/win/s9/win013.htm
The format of the string can be any, as the user can enter it at his discretion, and I need to translate it into the current culture.
c # excel globalization cultureinfo
Rand random
source share