How to change format (e.g. dd/MMM/yyyy) of DateTimePicker in WPF application

后端 未结 9 2166
春和景丽
春和景丽 2020-12-14 03:52

I want to Change the Format of date selected in DateTimePicker in WPF Application

9条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-14 04:12

    Typically the date time format is stored in a resource file, because this would help in internationalization of the app.

    You can pick up the format from the resource file and use a ToString(DATE_FORMAT)

    In your case you might want to use

    dateTimePicker.SelectedDate.ToString("dd-MMM-yyyy");
    

提交回复
热议问题