Some times we want to give a certain format on a datepicker control that we created. here's a quick example
Subscribe to:
Post Comments (Atom)
private void picker_Loaded(object sender, RoutedEventArgs e)// the datapicker's load event.
{
this.picker.Text = DateTime.Now.ToString("dd-MMM-yyyy");
}
private void picker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
{
this.picker.Text = this.picker.SelectedDate.Value.ToString("dd-MMM-yyyy");
}
a quit of a short example
var valueDate = valueDatePicker.SelectedDate.Value.ToString("s");
returns the set with the ISO format (yyyy-mm-dd)
No comments:
Post a Comment