Working with dates

fabrikI use dates in all sorts of ways with Fabrik. Sometimes they can be difficult to use. This article describes how to use date fields in different circumstances.


Show records dated in the future

If you've created a date field element in a list, you can use this date to pre-filter the list. Start by logging onto the back-end of Joomla with an admin account.

  1. Go to Components > Fabrik > Lists.
  2. Open your list for editing.
  3. Choose Data in the left pane.
  4. Select the Pre-filter tab.
  5. Click the Add button to create a new condition as follows:
  6. Field: Choose your date field.
  7. Condition: GREATER THAN.
  8. Value: CURDATE()
  9. Type: No quotes

 

Show records prior to a specific date

Open your list once more for editing.

  1. Choose Data in the left pane.
  2. Select the Pre-filter tab.
  3. Click the Add button to create a new condition as follows:
  4. Field: Choose your date field.
  5. Condition: LESS THAN OR EQUAL TO.
  6. Value: 2017-03-02 00:00:00
  7. Type: Text

 

Show records where the date is blank

Blank dates are saved as zeros in MySQL. Here are the Pre-filter settings.

  1. Field: Choose your date field.
  2. Condition: EQUALS
  3. Value: 0000-00-00 00:00:00
  4. Type: Text

 

Show records that are more than 2 years old

Add your new condition as before.

  1. Field: Choose your date field.
  2. Condition: LESS THAN.
  3. Value: CURDATE() - INTERVAL 2 YEAR
  4. Type: No quotes

 

Thanks for visiting.