LimeReport Forum

General Category | Основное => Discussion | Обсуждение => Topic started by: edwinantonykc on April 26, 2018, 02:38:30 pm

Title: Is there a "Date add" function
Post by: edwinantonykc on April 26, 2018, 02:38:30 pm
I am creating a Invoice using lime report. I need to make a date calculation here.
I have two variables InvoiceDate and DueDate. Assume the InvoiceDate is 26-04-2018 and DueDate is 15 then, I need to calculate 15 days from 26-04-2018 and show the result 11-05-2018 in a Text Item. Is that possible to do in the report?. Kindly help me.
Title: Re: Is there a "Date add" function
Post by: Arin Alex on May 07, 2018, 10:55:44 am
Hi!
You can add this javascript function to init script
Code: [Select]
function addDate(date, dayCount){
  var lDate = new Date(date);
  lDate.setDate(lDate.getDate()+dayCount);
  return lDate;
}
and use it in TextItem like this:
Code: [Select]
$S{dateFormat(addDate(now(),15))}
Title: Re: Is there a "Date add" function
Post by: edwinantonykc on May 09, 2018, 10:05:52 am
Hello,

Thank you very much for the reply and solution. Great job.. All the best and success

Regards,

Edwin Antony