Je ne suis pas sûr que ça réponde à ta question, mais quand tu crée ton DateTimePicker tu peux lui indiquer le format:
this.myDatePicker.CustomFormat = "dd MMM yyyy";
Sinon, pour récupérer la valeur tu peux faire:
1 2 3 4
| DateTime myTime = this.myDatePicker.Value;
Int myDay = myTime.Day;
Int myMonth = myTime.Month;
Int myYear = myTime.Year; |
Sinon il y a aussi ceci, trouvé ici:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| string formattedDate;
// Format : 07 / 03 / 2004
formattedDate = DateTime.Now.ToString("dd / MM / yyyy");
// Format : 7 / 3 / 2004 (without the preceding zeroes)
formattedDate = DateTime.Now.ToString("d / M / yyyy");
// Format : 07 / Mar / 2004
formattedDate = DateTime.Now.ToString("dd / MMM / yy");
// How to get the name of the day ?
// Format : Wednesday
formattedDate = DateTime.Today.DayOfWeek.ToString(); |
Au plaisir
Partager