History: Derived Attribute of a date
Source of version: 9 (current)
Copy to clipboard
! {{page}} 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: {CODE(colors="tiki")} {display name="creation_date" format="date" dateFormat="%m"} {display name="modification_date" format="date" dateFormat="%m"} {CODE} Full list of codes available here: http://php.net/manual/en/function.date.php It is similar to [https://github.com/nicolaskruchten/pivottable/wiki/Derived-Attributes|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 {CODE(caption="Use this in a Pivot Table so all dates are converted the month number" theme="default")}{display name="tracker_field_TimeSheetDate" default="" format="date" dateFormat="%m"}{CODE} !! ISO-8601 week number of year, weeks starting on Monday {CODE(caption="Use this in a Pivot Table so all dates are converted the week number" theme="default")}{display name="tracker_field_TimeSheetDate" default="" format="date" dateFormat="%W"}{CODE} !! Year and month The examples above will put data for January 2019 with January 2020 together. Instead, you can segment months like this: {CODE()}{display default="" name="tracker_field_TimeSheetDate" format="date" dateFormat="%Y-%m"}{CODE} !! Year and week And now for weeks. %o is used instead of %Y because [https://www.php.net/manual/en/function.date.php|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.] {CODE()}{display name="tracker_field_TimeSheetDate" format="date" dateFormat="%o-%W"}{CODE} !! Related links * [https://duckduckgo.com/?q=derived+attribute|derived attributes] * ((Date-based aggregations)) * https://github.com/nicolaskruchten/pivottable/wiki/Derived-Attributes