Menu

Function to calculate date and time

Documill Dynamo allows you to create a new date and time value using the date time calculation function. For example, you want to display in the template an expiry date, which will be 30 days from the date end-user creates the document. The date and time function is applied and based on the data type of the original date or time. Salesforce has 2 data types: Date and DateTime. You cannot use the function to calculate time (hours, minutes) from a Date field.

Add or reduce days to date

 Using the below functions to calculate a new date, which is some days, weeks, or years from the original date. Example use cases for this function:

  • Print an expiry date to an offer, which will be 30 days after the offer is created.
  • Create a new task or event in Salesforce, in which the due date would be 14 days after the task is created.

Add to date: plusDays(), plusWeeks(), plusMonths(), plusYears()

Remove from date: minusDays(), minusWeeks(), minusMonths(), minusYears()

The value inside () will be the amount of days, weeks, months or years to be added or removed from the original date.

You can add or reduce days to both Date or DateTime data type.

Add or reduce time to DateTime

 Using the below functions to calculate a new date, which is some hours, minutes or seconds from the original time.

Add time: plusHours(), plusMinutes(), plusSeconds()

Remove time: minusHours(), minusMinutes(), minusSeconds()

The value inside () will be the amount of hours, minutes, or seconds to be added or removed from the original time.

You can add or reduce time only from DateTime data type.

Example: Add a new date to the document, which will be 30 days after the document is generated

In the document template, create a span for the new date, in the Content attribute, give the value: today.plusDays(30)

Whenever the document is generated,the document will print a date which is 30 days from the created day. If the document is created on 16 February 2018, the new date will be 18 March 2018

-

Comments

0 comments