Changing the string format of the WPF DatePicker

前端 未结 9 1777
广开言路
广开言路 2020-11-27 14:56

I need to change the string format of the DatePickerTextBox in the WPF Toolkit DatePicker, to use hyphens instead of slashes for the seperators.

Is there a way to ov

9条回答
  •  温柔的废话
    2020-11-27 15:28

    XAML

     
    

    C#

    var date = Convert.ToDateTime(datePicker.Text).ToString("yyyy/MM/dd");
    

    put what ever format you want in ToString("") for example ToString("dd MMM yyy") and output format will be 7 Jun 2017

提交回复
热议问题