I'm creating an age counter app, but I couldn't use the date, which is user chose from the calendar. How can I use the day/month/year specified in MonthCalendar in my program?
TMonthCalendar
has a Date
property, which returns the user's selected date as a TDateTime
value. You can extract the individual month, day, and year values from that, if needed, by using the TDateTime::DecodeDate()
method.
TDateTime dtSelected = MonthCalendar1->Date;
Word wYear, wMonth, wDay;
dtSelected.DecodeDate(&wYear, &wMonth, &wDay);
...