Subtract 2 columns
Subtract 2 columns
zandotc
Posts: 2Questions: 1Answers: 0
How to subtract 2 columns?
http://imgur.com/a/wMOpc
thx
This discussion has been closed.
Answers
If your data comes from a database, have your database query deal with it.
There is no third date column. Shows only in client-side. The value of data1 subtracted from data2 generate data3
Data1 = 2017-01-05 15:10:20
Data2= 2017-01-06 15:10:20
Data3 = Data2 - Data1
What type of data will data3 be, ie, is it the time difference or something else?
You can do as Tangerine suggests and have your backend app perform the calculation and return the result as data3 along with the query result. Or you may be able to use
column.render
in the third column to perform the calculation.https://datatables.net/reference/option/columns.render
Kevin
Yes, on the client-side, using a data renderer is the way to do this. You may also want to use something like MomentJS to help make the date / time handling easier.
Allan