C# DateTimePicker Help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

C# DateTimePicker Help

I’m trying to create the Magic Dates program using the DateTimePicker. I am just not sure how to grab the individual values, such as day, year, or month, from it. My code returns the entire selection { DateTime myDate = myDateTimePicker.Value; lblOutput.Text = myDate.ToString(“F”); }

26th Jul 2020, 9:25 PM
Brent Larke
Brent Larke - avatar
1 Answer
0
string month= dateTimePicker1.Value.ToString("MMMM"); I have not tested it myself but according to this link. https://www.c-sharpcorner.com/forums/get-month-name-when-i-select-a-date-from-datetimepicker you can use this format https://www.c-sharpcorner.com/blogs/date-and-time-format-in-c-sharp-programming1
26th Jul 2020, 9:30 PM
sneeze
sneeze - avatar