How can i use datetimepicker in asp.net?
i.e
fromdate and todate

Recommended Answers

All 3 Replies

Simply drag two dateTimePickers onto your form, one for the from date and the other for the to date. You can then access the DataTimePicker.Text method to retrieve the value of either one. E.g. some simple code to get the days between two dates

Dim date1 As New Date
Dim date2 As New Date
date1 = DateTimePicker1.Text
date2 = DateTimePicker2.Text
Label1.Text = (date2 - date1).ToString

ASP.NET does not have a datetimepicker control as in VB.NET. the closest to serve this perpose is the Calendar or CalendarExtender which is in the AjaxControlsToolkit. This will give you only the date and not attach the time to it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.