How to create a date or date and time object in the advanced formula editor.
Table of contents
Formulas are at the core of Plecto. Every number displayed on a dashboard comes from a formula. With them, you can express a wide range of calculations that should be made on your data.
Formulas are saved as plain text. However, for it to work correctly it 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.
Your data in Excel are rows in a spreadsheet and you can filter and manipulate this data based on it's columns. Similarly in Plecto, registrations are the rows and fields are the columns.
You can use the following functions to create a date or date and time object:
- Today() > todays 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. Read more about this function and the available country codes here.
Here is an example on how to output the number of Danish holidays from a formula: