Date time change time to midnight

Easy one here user gives a date time through the date time picker, instead of the time picked i want the date to set to midnight.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Set it to 00:00

Dim dt as DateTime = datetime.parse(selecteddate & " 00:00")
MillkindAuthor Commented:
not a valid date time is the error.

selected date time comes in with a time already on it.  So we have to change the time it came with to midnight.
Try either

Dim dt As DateTime = selectedDate.AddMinutes((24*60) - SelectedDate.TimeOfDay))

or use ParseExact
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
Just use the Date() property of the DateTime instance as it returns the Date portion with the Time portion set to midnight...

    "A new object with the same date as this instance, and the time value set to 12:00:00 midnight (00:00:00)"


    someDateTime = someDateTime.Date

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MillkindAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.