Loading...
 
Skip to main content

Derived Attribute of a date

For any WikiPlugin that uses Search and List from Unified Index (ex.: very useful in PluginPivotTable but it works in PluginList etc.)

You can customize the date format to show only the date or week or month, not the specific date or time. Ex.:

  • only the day number of the month with %d , or
  • only the day number of the year with %z , or
  • only or the week number of the year with %W , or
  • only the month number with %m , or
  • only the year with %Y , etc

This way, you can get the aggregated values of interest for your report.

Example of code to display only the month number from these dates so that you can draw charts with counts per month, etc:

Copy to clipboard
{display name="creation_date" format="date" dateFormat="%m"} {display name="modification_date" format="date" dateFormat="%m"}


Full list of codes available here:
http://php.net/manual/en/function.date.php

It is similar to this but directly in Tiki. And it's fast because it's done by PHP. It is also similar to Grouped Data.

Numeric representation of a month, with leading zeros

Use this in a Pivot Table so all dates are converted the month number
Copy to clipboard
{display name="tracker_field_TimeSheetDate" default="" format="date" dateFormat="%m"}

ISO-8601 week number of year, weeks starting on Monday

Use this in a Pivot Table so all dates are converted the week number
Copy to clipboard
{display name="tracker_field_TimeSheetDate" default="" format="date" dateFormat="%W"}

Year and month

The examples above will put data for January 2019 with January 2020 together. Instead, you can segment months like this:

Copy to clipboard
{display default="" name="tracker_field_TimeSheetDate" format="date" dateFormat="%Y-%m"}

Year and week

And now for weeks. %o is used instead of %Y because This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead.

Copy to clipboard
{display name="tracker_field_TimeSheetDate" format="date" dateFormat="%o-%W"}