DateTimePicker - Time value?

  • Thread starter Thread starter Chris Ashley
  • Start date Start date
C

Chris Ashley

How do I stop my DateTimePickers storing a time value? I just need to insert
the date part into my database but the DateTimePicker.Value property seems
to be in the format ##/##/## ##:##:##
 
If you are going to use a DateTime datatype to hold the value then
ofcourse a time element will be involved, is the database field a string
or a datetime?

You can get just the date part of a DateTime by using
DateTime.ToShortDateString() or DateTime.ToLongDateString()

Let me know how you are storing the value in the DB and how are you
showing it in the UI, i'll be able to help you better.

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph
 
Chris,
Or just use myDateTime.Date to get the Date part of the value for
storing in the database.

Ron Allen
 
Ron Allen said:
Chris,
Or just use myDateTime.Date to get the Date part of the value for
storing in the database.

Ron Allen

Hi,

That works great - thanks for the help!

Chris
 
Back
Top