I want to create a IFormatProvider such that number formatting works like it does in CultureInfo.InvariantCulture but date formatting works customized to a short date.
Such that AnyStringDoubleDate.ToString(CultureInfo.InvariantCulture) results in a long dateformat for dates, which I don't want, but all other formats are fine already.
Is there a way to change this behavior for dates?
I can only use String.ToString().
Of what type is
AnyStringDoubleDate? You cannot format a string. Formatting is involved when converting a non-string value to a string. Therefore, you must start with aSystem.DateTime(having the aliasDatein VB). Then you can specify a format by using this overload ofDateTime.ToString:Then you can write:
Or use any other Standard date and time format string or a Custom date and time format string.