Some reflection may ensure that you get the same extended format strings that are used internally:
string GetRealFormat(string format, DateTimeFormatInfo dtfi) { MethodInfo method = Type.GetType("System.DateTimeFormat") .GetMethod("GetRealFormat", BindingFlags.Static | BindingFlags.NonPublic); return method.Invoke(null, new object[] { format, dtfi }) as string; }
string format = GetRealFormat("d", DateTimeFormatInfo.CurrentInfo)
source share