Question remove time in datetimepicker

ryanescal

Member
Joined
Sep 24, 2011
Messages
7
Programming Experience
3-5
Hi Everyone
how can i remove the time when i inserted into the database using datetimepicker??.
 
You don't use a DateTimePicker to insert anything into a database. You use a DateTimePicker to display a date and/or time to the user and/or accept their input. It doesn't matter to the DTP where the date/time is going to or coming from.

So, how do you usually interact with a DateTimePicker in code? Via its Value property, right? And what type is that property? DateTime, right? Have you read the documentation for the DateTime type? If you had you would know the answer to your question. In that documentation you would find that there is a Date property and a TimeOfDay property, for getting just the date and just the time portion.
 
How to pick the date and exclude the time from a DatetimePicker

if you want it to save as date without time then it means you will have to specify that on your call for the DatetimePicker value. Example: Dim mydate as date = datetimepicker1.value.date If u say Datetimepicker1.value without ".date" at the end it will give you both the date and time. Again, if you want to exclude the Date and get the time alone you will have to assign DatetimePicker1.value.timeofday to whatever you want the return value Hope That Works
 
if you want it to save as date without time then it means you will have to specify that on your call for the DatetimePicker value. Example: Dim mydate as date = datetimepicker1.value.date If u say Datetimepicker1.value without ".date" at the end it will give you both the date and time. Again, if you want to exclude the Date and get the time alone you will have to assign DatetimePicker1.value.timeofday to whatever you want the return value Hope That Works

While I appreciate your desire to help, you really shouldn't resurrect threads that are five years old, only to repeat advice that has already been provided five years ago.
 
Back
Top