Date Format
Extract part of date columns to new formats
You can use the Date Format tool to extract parts of date columns - such as a weekday or year. It is particularly helpful in combinations with others tools. Such as a Filter to keep transactions from the current year or a Group By + Combine to merge datasets by Year/Month.
The columns you use in the Date Format tool must be formatted as a date/datetime. Use the Change Columns tool to change column formats.
Configuration
The Date Format tool consists of two required input.
Select Date Column
Select the column from which you want to extract part of the date
Select the Part
Select the parts of the you want to extract. You can choose from the following:
- Date: helpful if you just want to the date from a column that has timestamps
- Hour: extract the hour from the timestamp
- Week: extract the ISO week from a date
- Weekday: extract the weekday from a date (1 = Monday)
- Month: extract the month from a date (1 = January)
- Monthname: extract the month name from a date (e.g. January)
- First Day of Month: get the first day of a given month from a date (e.g. 2024-10-10 → 2024-10-01)
- Last Day of Month: get the last day of a given month from a date (e.g. 2024-10-10 → 2024-10-31)
- Quarter: extract the quarter that a date is in
- Year Half: extract the year half that a date is in (e.g. 2024-10-10 → 2)
- Year: extract the year of a date (e.g. 2024-10-10 → 2024)
When To Use
The Date Format tool is typically used alongside other tools. The output of the tool oftentimes is necessary to continue the analysis.
- Extract the year of a date column and use a Filter tool and Today tool to ensure you only look at the current year
- Extract a month and a year from a date column to prepare an aggregation with a Group By and subsequently a Combine
- Extract the first of the month to standardize payroll transactions
Examples
Weekend General Ledger Entries
Weekend General Ledger Entries
My employees shouldn’t make general ledger entries in the week, so I want to find all the ones where that’s the case
See how we use the Filter to keep only the transactionDate_weekday values that are larger than 5 - note that weekday = 6 is a Saturday and weekday = 7 is a Sunday
Filter on Current Year
Filter on Current Year
I only want to keep records that happened in the current year
See how we use the Today to generate a dynamic current timestamp. Then we use the Date Format to extract a year from both our transactionDate and today column. Lastly, we add a Filter that only keeps the records where the year of today and of the transactionDate are the same.
Sales by Weekday
Sales by Weekday
I want to understand how my sales are distributed according to weekday
After the Group By tool you can get results like the below