I'm looking to get the number of days between a du...
# advancedpdf
b
I'm looking to get the number of days between a due date and today on a PDF, I have a function:
Copy code
<!-- Function -->
<!-- Calculate Days between two dates -->
<#function daysDiff date1 date2>
  <#assign days = ((date1?long - date2?long) / (1000 * 60 * 60 *  24))?int />
  <#return days>
</#function>
and then when going through the lines:
Copy code
<#if line.duedate?has_content>
    <#assign date_today = .now?date />
    <#assign due_date = line.duedate?date("MM/dd/yyyy") />
    <#assign daysoverdue = daysDiff(date_today, due_date) />
      <td align="center" colspan="3">${daysoverdue}</td>
    <else>
      <td align="center" colspan="3">&nbsp;</td>
    </#if>
but it is not working, any ideas?
c
I'd do it in a custom field in netsuite and then just pull in that field into the PDF since these are 2 bodyh fields it looks like
💯 3
b
@creece yeah, that's what I figured, it's for the statement advanced pdf so will have to do a script or workflow to store the value so I can use it on the statement. Thanks!