Skip to content
Learn › Clean and shape data: open the docs menu

Work with dates and financial years

Mammoth's date functions shift dates, pull out parts such as the month or weekday, add a financial year and measure the time between two dates. Open them from the Describe your transformation bar (or a + button in the Pipeline panel) and select Date, Numeric & Text. Each one is a pipeline task, so it changes your data and runs again every time the pipeline refreshes.

Before you start

Only Date columns appear in the date dropdowns. If your dates are stored as text, convert them first with Convert Column Type in Column Management. See Convert text to dates and numbers.

Add or subtract days, months or years from a date

Add / Subtract Date Values moves a date forward or back by the amount you set. Use it for deadlines, expiry dates or lining up dates across periods.

Add / Subtract Date Values panel adding 30 days to event_date, with the result placed in a new column New_event_date
  1. In Select column, choose the date column.
  2. In Select behaviour, choose Add or Subtract.
  3. Enter an amount in one or more of the duration fields: Years, Months, Weeks, Days, Hours, Minutes or Seconds. Fields left at 0 are ignored.
  4. Optional: click Add Condition to shift only the rows that meet a condition.
  5. In Place in, choose New Column and type a name, or choose Existing Column and pick the column to overwrite.
  6. Optional: click the calendar icon next to the result column options to pick the date format. The formats come in Universal, US and UK groups.
  7. Click Apply.

Example: to set a review date 30 days after a contract starts, select contract_start, choose Add, enter 30 in Days and name the new column review_due.

Get the year, month, weekday or time from a date

Extract Date Part pulls one part out of a date, such as the year, month name, week number or hour, and writes it to a new column.

Extract Date Part panel with event_date selected, date part Day (number), and result column Days
  1. In Select column, choose the date column.
  2. In Select date part, choose the part you want. Each part shows an icon for its result type (number, text or date).
  3. Name the result column and click Apply.

The pipeline card names the result type in brackets, for example "Month name (text)".

Date partResult typeReturns
YearNumberFor example 2024
QuarterNumber1, 2, 3 or 4
MonthNumber1–12
Month nameTextFor example "March"
Week of the yearNumber1–52
WeekdayTextFor example "Monday"
DayNumber1–31
Day of yearNumber1–365
HourNumber0–23
MinutesNumber0–59
SecondsNumber0–59
MillisecondNumber0–999
Time without millisecondsTextFor example "14:40:45"
Time with millisecondsTextFor example "14:40:45.123"
Year & MonthTextFor example "2024 March"
Year & Month NumberTextFor example "2024-03"
Date part without timeDateThe date with its time removed
Date part without timeTextThe same, returned as text

Financial years are not in this list. Use Financial Year, below.

Example: to group sales by month, extract Month name from order_date. The new column holds values such as "January" and "February", ready to use as a group in Group, pivot and unpivot.

Add a financial year column

Financial Year adds a Number column with the financial year each date falls in, such as 2025. A financial year is named by the year it ends in. With a year that starts in October, October 2024 to September 2025 is 2025.

  1. In the Transform menu, select Date, Numeric & Text > Financial Year. The Extract Date Part panel opens with a Year starts in dropdown in place of Select date part. It is set to October.
  2. In Select column, choose the date column.
  3. In Year starts in, choose the month your financial year starts, from January to December.
  4. Check the hint under the form. It shows the last day of the old year and the first day of the new one, for example "Sep 30, 2025 becomes 2025, Oct 1, 2025 becomes 2026. The year is named by the year it ends in." The date format follows your browser.
  5. Name the result column (the default is "Financial year") and click Apply.

How the financial year number is worked out

The result is a whole number with no decimals and no thousands separator, such as 2026.

  • A date in or after the start month belongs to the next year's number.
  • A date before the start month keeps its calendar year.
  • Choosing January gives the calendar year, the same as extracting Year.
Year starts in15 Mar 202515 Jul 202515 Nov 2025
January202520252025
April202520262026
July202520262026
October202520252026

The pipeline card describes the step, for example "Financial year, starts in April (number)". To change the start month later, edit the step and pick another month in Year starts in. The value comes from each row's date, so it only changes between runs if the date does.

Calculate the number of days between two dates

Calculate Date Difference measures the time between two dates and returns a number. Each end can be a date column or the current time in UTC.

Calculate Date Difference panel with Start Date and End Date each set to Date Column or Current Time (UTC), a Select Unit dropdown, and a new number column name
  1. In Start Date, select Date Column and choose a column, or select Current Time (UTC). With Current Time (UTC), the column dropdown goes away.
  2. Set End Date the same way.
  3. In Select Unit, choose Years, Months, Weeks, Days, Hours, Minutes or Seconds.
  4. In Place in, choose New Column and type a name, or choose Existing Column to overwrite one.
  5. Click Apply.

Examples:

  • To measure shipping time, set Start Date to order_date, End Date to ship_date, the unit to Days and the name to days_to_ship.
  • To count the days since each customer signed up, set Start Date to signup_date and End Date to Current Time (UTC).

How each unit is counted

The result is End Date minus Start Date. It is negative when the end comes before the start.

UnitHow it countsExample: 2024-12-31 to 2025-01-01
YearsThe difference between the calendar year numbers. Months and days are ignored.1
MonthsThe difference in calendar months (years × 12 plus months). Days are ignored.1
WeeksWhole days divided by 7, rounded toward zero0
DaysWhole days between the two dates1
Hours, Minutes, SecondsWhole days converted to that unit, plus the remaining hours, minutes and seconds24 hours

Years and Months only look at the calendar numbers, so 2024-01-31 to 2024-02-01 counts as 1 month. Use Days when you need an exact span.

Current Time (UTC) is the moment the step runs. A result that uses it changes on every run.

Troubleshooting

SymptomCauseFix
Your date column is missing from the dropdownThe column is stored as text, and only Date columns are listedAdd a Convert Column Type step before this one. See Convert text to dates and numbers.
A month difference looks too largeMonths ignores days, so 31 Jan to 1 Feb is 1 monthUse Days for an exact span
A days-since value changes every dayThe step uses Current Time (UTC), which is the time of each runThis is expected. Use a fixed date column if you need a stable number.
Dates arrive in mixed formats and sort wronglyThe column is text, not DateSee Fix a failing step for the date format fix
Was this page helpful?

Something wrong? support@mammoth.io