Working with dates
To work with dates, a number of special types of fields have been developed, which we will consider in detail in this article.
Date with calendar picker
There are two types of fields for entering a date in the record form:
- Date with calendar picker
- Date with calendar and time picker
These fields are identical in settings. On the Settings tab, you can specify a custom format for a specific field.
On the "Extra" tab, you can set the Default Date and the Minimum/Maximum date that can be selected in the calendar. For example: 0 - current date, 5-current date + 5 days.
The "Color" tab contains a number of settings for highlighting the date with color. An overdue date, or a date several days before the specified date, can be highlighted in color.
Please note: the "Disable color" option disables date highlighting when a certain value of the "drop-down list" field type is set.
Difference between dates
The following fields are provided for calculating the difference between dates:
- Years difference
- Months difference
- Days difference
- Hours difference
These field types have similar settings, where you need to specify two fields between which the difference will be calculated.
Use the "Perform dynamically" option only for calculations between the current date. Please note: this option increases the load on the server.
The "Exclude holidays" option excludes dates set on the "Configuration - Holiday" page.
Dynamic date
Special field type that calculates the date using a MySQL formula. This type of field can be used in filters of records by date, as well as used in a calendar report or Gantt chart.
Dates in Rukovoditel are stored in timestamp (in seconds), so to increase the date by 1 day, you need to add 86400 seconds.
Let's look at a few examples:
[159]+(86400*[150])
159 - date field with calendar.
150 - the input field that stores the number of days.
[159]+(86400*get_value([151]))
159 - date field with calendar.
151 - drop-down field, the value of which is multiplied by 1 day.
Use the following example to get the date from the parent entity:
(select field_159 from app_entity_21 where id=e.parent_item_id)
159 - ID of the date field in the parent entity
21 - ID of the parent entity