Hi, I using WPF -> XAML and I have a DatePicker.
My question is: How do I change the DatePicker date format to yyyy-MM-dd using XAML or C# ?
I really need help PLEASE.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Tom MohanRank #912 · 2.3K reputationPosted Apr 3, 2015, 3:38 AM EDT
Use StringFormat in XAML
Guest User25 reputationPosted Apr 3, 2015, 3:45 AM EDT
Tom MohanRank #912 · 2.3K reputationPosted Apr 3, 2015, 4:26 AM EDT
Guest User25 reputationPosted Apr 3, 2015, 4:41 AM EDT
Tom MohanRank #912 · 2.3K reputationPosted Apr 3, 2015, 5:09 AM EDT
in pageload/ctor
CultureInfo ci = CultureInfo.CreateSpecificCulture(CultureInfo.CurrentCulture.Name);
ci.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd";
Thread.CurrentThread.CurrentCulture = ci;
property
private DateTime dateOfBirth = DateTime.Now;
public DateTime DateOfBirth
{
get { return dateOfBirth; }
set { dateOfBirth = value;
OnPropertyChanged("DateOfBirth");
}
}
xaml
Guest User25 reputationPosted Apr 3, 2015, 6:58 AM EDT
Tom MohanRank #912 · 2.3K reputationPosted Apr 3, 2015, 7:40 AM EDT
Mageshwaran RRank #411 · 6.1K reputationPosted Nov 24, 2019, 7:17 AM EST