convert days by weeks
convert days by weeks
bechirmrad
Posts: 20Questions: 6Answers: 0
i want to convert the days in the datatable in another column but with weeks of the year !!
like week 1 week 2 ...
and thanks
This discussion has been closed.
Replies
Hi @bechirmrad ,
You can use a function in
columns.render
to do the maths - see the fourth example on that page. For the maths, best bet is to Google it, I just tried and there's a quite a few hits.Cheers,
Colin
MomentJS is my go to library for date and time calculations.
Allan
ok i will try
This example ??
$('#example').dataTable( {
"columnDefs": [ {
"targets": 0,
"data": "download_link",
"render": function ( data, type, row, meta ) {
return '<a href="'+data+'">Download</a>';
}
} ]
} );
Yep, so instead of returning (displaying) the value of "data" as it would normally do, it now forms a "href" instead. Here, you would grab the value from "row" for the other date, do your conversion, and return the week number.