Loading...

RE: qListView and Current Date

RE: qListView and Current Date

#7408
Anonymous
Anonymous
Participant

Hi

n

I suggest you can try to write some JavaScript to format the Calculated field in qListView.

n

1. Add a Script Editor web part into the page, insert a JavaScript about format the date function, it will be used as formating function in the calculated field in qListView. something like:

n

<script>

n

function FormatDate(date){

n

   var oldDate = new Date(date);

n

   var today = new Date();

n

   return oldDate .getDate() – today.getDate();

n

}

n

</script>

n

2. Add a custom filed in qListView, invoke the JavaScript function in ‘Calculated Value’ setting, something like below, the <%Date%> is a parameter that you want to format:

n

<script>FormatDate('<%Date%>');</script>

n

But I would like the mention that if you do that, this calculated field cannot be sorted any more.

n