This is a migrated thread and some comments may be shown as answers.

rounding the SelectedValue to the nearest minute

1 Answer 98 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
Elneilo
Top achievements
Rank 1
Elneilo asked on 23 Nov 2011, 02:28 AM
I'm new to the RadDateTimePicker and I'm wondering if the control can allow me to
round the SelectedValue to the minute (to effectively zero-out the seconds and milliseconds portion).

<telerik:RadDateTimePicker SelectedValue="{Binding TheVisitDateTime, Mode=TwoWay}"/>

I need it for calling a stored procedure with a SMALLDATETIME Parameter (which I'm not allowed to change).
So before I consider writing a ValueConverter for this, I need to know if the RadDateTimePicker control exposes a property for rounding to the minute ?

Right now the milliseconds is being passed to the stored procedure which is causing a conversion error.
(because the @dVisitDateTime is SMALLDATETIME data type).

exec schma.CompleteClientVisit @iVisitID = 1, @dVisitDateTime = '2011-11-22 15:47:10.25039', ...other params...
Msg 8114, Level 16, State 1, Procedure CompleteClientVisit, Line 0
Error converting data type varchar to smalldatetime.

My goal is to call the stored procedure such as below to avoid the conversion error.
exec schma.CompleteClientVisit @iVisitID = 1, @dVisitDateTime = '2011-11-22 15:47:00', ...other params...

1 Answer, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 25 Nov 2011, 04:55 PM
Hello Elneilo,

I am afraid, there is no build in property in the DateTimePicker for achieving this. You are going to have to create a converter which will return time in the needed format.

Kind regards,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
DateTimePicker
Asked by
Elneilo
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Share this question
or