Utilisez RFC1123 pattern. String.Format("{0:r}", dt);
Standard Date and Time Format Strings
SpecifierDateTimeFormatInfo propriétévaleur modèle (pour la culture en-US)
t ShortTimePattern h:mm tt
d ShortDatePattern M/d/yyyy
T LongTimePattern h:mm:ss tt
D LongDatePattern dddd, MMMM dd, yyyy
f (combination of D and t) dddd, MMMM dd, yyyy h:mm tt
F FullDateTimePattern dddd, MMMM dd, yyyy h:mm:ss tt
g (combination of d and t) M/d/yyyy h:mm tt
G (combination of d and T) M/d/yyyy h:mm:ss tt
m, M MonthDayPattern MMMM dd
y, Y YearMonthPattern MMMM, yyyy
r, R RFC1123Pattern ddd, dd MMM yyyy HH':'mm':'ss 'GMT' (*)
s SortableDateTimePattern yyyy'-'MM'-'dd'T'HH':'mm':'ss (*)
u UniversalSortableDateTimePattern yyyy'-'MM'-'dd HH':'mm':'ss'Z' (*)
Est-il affiché de cette façon sur le formulaire, ou est-ce qu'il retourne dans ce format à votre code? – Mikecito
Vous pouvez capturer la date telle qu'elle est et la formater plus tard. C'est comme ça que je le fais. Mais je ne sais pas pourquoi cela ne fonctionne pas dans ce cas. –