简体   繁体   中英

Windows Form C# dateTimePicker (it only gets date and not time)

I am building a Windows Form web service app and I have 2 dateTimePicker. The first one its for the start the and the second one its for the end date.

In the dateTimePicker format I have set it to Time. When I select any date from the start or end date, the date change but the time does not change.

I need the date and any time that I will chose within the application.

Here you have the 2 variables how I have set the dateTimePicker

DateTime startDate = dateTimePicker1.Value.Date;
DateTime endDate = dateTimePicker2.Value.Date;

Thanks you in advance

I found the solution. I have to remove the date after the value.

Thanks anyways

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM