We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Setting time in DateTimePicker

Is there a way to force the time to midnight, 00:00:00 when saving to a SQL server database regardless of the current time? Thanks!

4 Replies

AR Anupama Roy Syncfusion Team February 22, 2006 05:06 AM UTC

Hi, You can consider writing something like this inorder to force the time to "00:00:00" .Here the variable "t" checks for the time and finally returns the value you want. TimeSpan t=this.dateTimePickerAdv1.Value.TimeOfDay; if(t>TimeSpan.Parse ("00:00:00") || t

AR Anupama Roy Syncfusion Team February 22, 2006 05:10 AM UTC

Hi , The code snippet seems to be chewed up.Please take a look at this. TimeSpan t=this.dateTimePickerAdv1.Value.TimeOfDay; if(t>TimeSpan.Parse ("00:00:00") || t

AR Anupama Roy Syncfusion Team February 22, 2006 05:17 AM UTC

Hi, Take a look at the sample for the above mentioned code snippet. Sample Regards, Anu.


JV John Valescu February 22, 2006 03:47 PM UTC

Anu, Thanks for the quick response. I actually want to change the time to 00:00:00 before commiting it to the SQL database. I''ve tried changing some of the members of the class, but most of them are read-only. >Hi, > >Take a look at the sample for the above mentioned code snippet. >Sample > > >Regards, > >Anu. > >

Loader.
Live Chat Icon For mobile
Up arrow icon