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 ##/##/## ##:##:##

Re: DateTimePicker - Time value? by Sijin

Sijin
Tue Oct 19 06:12:17 CDT 2004

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 Ashley wrote:
> 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 ##/##/## ##:##:##
>
>

Re: DateTimePicker - Time value? by Ron

Ron
Tue Oct 19 07:58:05 CDT 2004

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

Ron Allen
"Sijin Joseph" <sijinNOSPAMdotnet@hotmail.com> wrote in message
news:uWo0CyctEHA.2864@TK2MSFTNGP09.phx.gbl...
> 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 Ashley wrote:
>> 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 ##/##/## ##:##:##



Re: DateTimePicker - Time value? by Chris

Chris
Tue Oct 19 10:42:44 CDT 2004

"Ron Allen" <rallen@_nospam_src-us.com> wrote in message
news:%23wfoItdtEHA.376@TK2MSFTNGP09.phx.gbl...
> 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