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

Subtract date

2 Answers 18 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Felice
Top achievements
Rank 1
Felice asked on 08 Jan 2014, 06:11 AM
I need to subtract two date from dateTimeColumns.

I tried in the designer:
DATEDIFFDAY(Periodo, Data_Pagam), in the designer

I tried with the code:

 radGridView1.Columns["Ritardo"].Expression = "Periodo-Data_Pagam";


I keep getting this error:
Invalid Expression:
"Cannot perform '-' operation on System.DateTime and System.DateTime

Please help.

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 08 Jan 2014, 03:42 PM
Hello Felice,

Thank you for writing.

You should specify the appropriate parameters directly when you are initializing the expression:
radGridView1.Columns["Duration"].Expression = "DATEDIFFDAY(StartTime ,EndTime)";

Also I have attached a sample project that contains a sample implementation for such functionality.

I hope this will be useful. Should you have further questions, I would be glad to help.

Regards,
Dimitar
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Felice
Top achievements
Rank 1
answered on 09 Jan 2014, 06:39 AM
Thank you, you solved my problem.
Tags
GridView
Asked by
Felice
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Felice
Top achievements
Rank 1
Share this question
or