Date Functions

How to create a date or date and time object in the advanced formula editor.

Last updated: April 15, 2021

Table of contents

Formulas are at the core of Plecto. Every number that is displayed on a dashboard comes from a formula. With them, you can express a wide range of calculations that are made on your data.

Formulas are saved as plain text, however, for them to work correctly, they must follow a very specific syntax. You can think of it as a programming language. The language is similar to that of Excel or other spreadsheet software. Where in Excel you have rows and columns, in Plecto we call them registrations and fields.

Available functions

You can use the following functions to create a date or date and time object:

  • Today() > today's date
  • Now() > the date and time right now
  • Startdate() > the starting date and time selected on the widget
  • Enddate() > the ending date and time selected on the widget
  • Date(<year>,<month>,<day>) > a specific date

You can then pass this date object to the following functions:

  • Year(<date>) > returns the date's year
  • Month(<date>) > returns the date's month
  • Day(<date>) > returns the date's day
  • Hour(<date>) > returns the date's hour
  • Days(<start_date>,<end_date>) > returns the number of days in the given interval
  • Networkdays(<start_date>,<end_date>) > returns the number of working days in the given interval
  • Holidays(<country_code>,<start_date>,<end_date>) > returns the number of holidays in the given interval.

Here is an example of how to output the number of Danish holidays from a formula:

date-functions

An advanced formula to output the number Danish holidays.

Note: Read more about the Holidays function and the available country codes here.

Was this article helpful?