Articles in this section

How to display the current date using Now()

This article explains what the Now() function is and provide examples of how it can be used with the binding syntax in smart templates.  

  Prerequisites

  • Library and at least one Dynamics modules enabled.
  • Templafy Desktop and Office VSTO add-in installed on the PC.
  • Space owner access to the Templafy tenant.

  Important

Now() isn't supported when distributing a default template to end-users via Library Configuration tab.

What is the Now() function? 

Now() is a function that returns the current date. Now() is very often used in together with FormatDateTime() function. 

Now() logic

Syntax {{Now()}}
Input n/a
Output unformatted current date (e.g. '2025-02-03')

Now() function examples

Example 1

Using Now() together with the FormatDateTime() function to show today's date formatted according to 'dddd d MMMM yyyy' for the "en-US" language. The binding is:

{{FormatDateTime(Now(),"dddd d MMMM yyyy","en-US")}}

Input Today's date = 2020-11-12
Output "Thursday 12 November 2020"

Example 2

Using Now() together with the Translate() function to show today's date formatted according to the 'DocumentLanguage' set in the User Profile. The binding is:

{{FormatDateTime(Now(), Translate("FormatLongDate", DocumentLanguage), DocumentLanguage)}}

Input

Today's date = 2020-11-12

FormatLongDate = "ddd d MMMM yyyy"

DocumentLanguage = "en-US"

Output "Thu 12 November 2020"

 

AIP MPIP MIP tech_role
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.