What property in CultureInfo.InvariantCulture
helps to discard the functionality of "/"
.
I am having this problem because I have my customCulture.
and when I use it to format DateTime
it replaces "/"
with the culture Specific separator.
So I want to know what property if I change in my customCulture
the functionality of "/"
will be discarded.
Let me clear my problem,
I want to export some data to a file with DateTime as specified by user.
I am creating customCulture as follows
CultureInfo customCulture = new CultureInfo(CultureInfo.CurrentCulture.Name);
I am taking the date format from the user and injecting it into my CustomCulture object as
customCulture.DateTimeFormat.ShortDatePattern = MyClass.DateFormatFromUser;
Now when I want to convert this to String pattern. I am doing it as follows,
string.Format(customCulture, "{0:G}", dateTimeValue);
Now the problem is String.Format replaces any "/" present in ShortDatePattern with customCulture.DateTimeFormat.DateSeparator
For example if he user gives the format as
dd/MM/yyyy
and my current culture is faeroese ie., {fo-FO}
For these I get output as 25-09-1990.