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

Convert text to dates and numbers

The Convert Column Type task changes a column's type: to Text, Number or Date, or to a meaning such as ID, Currency or Percentage. Open it from Column Management in the Transform menu, or from Convert Column Type in a column's 3-dot menu. It is a pipeline task, so it re-runs on every refresh, and a value that can't be converted becomes empty.

Convert one or more columns with Convert Column Type

Convert Column Type panel with three conversion rows for customer_age, brand and a date column, and a data-loss note
  1. Click Describe your transformation (or a + in the Pipeline panel), choose Column Management, then Convert Column Type.
  2. In Select columns to convert, choose the source column. Each row handles one column.
  3. In Select new column type, choose the target. Number offers Number, ID, Percentage and Currency; Text offers Text and ID; Date is a single option. The column's current type is greyed out.
  4. Set the output format if the panel asks for one (see the table below).
  5. To convert another column in the same task, click + Convert more columns. Click the trash icon on a row to remove it.
  6. Click Apply.
SettingWhen it appearsWhat it does
Values are on a 0–100 scale (the label goes on to say "divide by 100")Converting a Number column whose largest value is above 1 to PercentageTicked by default. Divides every value by 100, so 45 becomes 0.45 (45%). Untick it to keep the values. Not shown for Text columns or for columns already between 0 and 1.
Format OutputConverting to Date, or from Date to TextConvention: Universal, UK, US or Custom. Format string: a format from the list (for example YYYY/MM/DD, YYYY/MM/DD HH24:MI:SS, YYYY/MM/DD HH:MI:SS am, YYYY-MM-DD) or Custom to type your own.
Number format controlsConverting to NumberSet the number format of the result.
Define Source Format (gear icon next to the format string)Converting Text to DateTells Mammoth what format the text is in now. See Tell Mammoth the order of day and month.

If a value can't be converted to the target type (for example "John Doe" to Number or Date), it becomes empty (null).

For example, an order_date column imported as Text holds values like "2025/01/15". Select it, choose Date, set the source format to Source - Auto, and set Format Output to YYYY/MM/DD. The column is now a real Date you can use in date filters and calculations.

Convert a column to ID, Currency or Percentage

Picking another entry under the column's own type (for example Currency for a Number column) changes only what the column means. It doesn't cast the values, except with the divide-by-100 option above. The number format in the panel follows the target:

TargetFormat the panel sets for you
CurrencyNever a percentage. The currency symbol stays yours to pick.
PercentageNever a currency symbol. The % starts on and can be switched off.
ID (Number)No currency symbol, no %, no thousands separator. Decimals start at 0 unless the column already had its own.

Converting a code such as 000417 to ID under Text keeps the leading zeros. Converting it to a Number drops them. For what each type means, see Column types, IDs, currency and percentages.

Convert text to a date

You can let Mammoth detect the date format or give it format codes.

With Source - Auto, Mammoth samples the column's values and detects the formats present. This works for most real-world data. For uncommon or mixed formats, use format codes.

Tell Mammoth the order of day and month

A date made only of numbers, such as 01/02/2025, could be 2 January (US) or 1 February (UK). Choose the source format to settle it:

OptionReads 01/02/2025 asUse when
Source - AutoDetected from your data; may guess wrongYour dates are mostly unambiguous (month names or clear patterns)
Source - DD/MM/YYYY (Day First)1 February 2025Dates are always day first
Source - MM/DD/YYYY (Month First)2 January 2025Dates are always month first
Source - Custom (multiple formats)Your format codesMixed formats or non-standard patterns

If your dates are ambiguous, always choose Day First or Month First rather than Auto. This prevents silent parsing errors.

Date format codes

Mammoth reads text using PostgreSQL-style format codes:

CodeMeaningExampleNotes
YYYY4-digit year2025Use YY for 2-digit years (25)
MMMonth (01-12)01
DDDay of month (01-31)15
HH24Hour (24-hour, 00-23)14Use HH12 or HH for 12-hour format (01-12)
MIMinute (00-59)30
SSSecond (00-59)45
MON / MONTHMonth nameJan / JanuaryMON is abbreviated, MONTH is full. Write the code in upper, title or lower case: MON, Mon, mon, MONTH, Month, month
DAY / DYWeekday nameWednesday / WedDAY is the full name, DY a 3-letter abbreviation. Upper, title or lower case
AM / PMAM/PM indicatorAMWrite it AM, am, PM, pm, A.M., a.m., P.M. or p.m.
TZTime zone nameUTCA time zone abbreviation, such as PST, EST or UTC
OFTime zone offset+00:00±HH:MM or ±HHMM
Literal "T"The letter TTMatches the T in ISO format (2025-01-15T14:30:00)
Literal "Z"The letter ZZMatches the ISO Zulu indicator (2025-01-15T14:30:00Z)

Common date formats and their codes

FormatFormat codeInputResult
ISOYYYY-MM-DD2025-01-15January 15, 2025
ISO 8601 with timeYYYY-MM-DD"T"HH24:MI:SS"Z"2025-01-15T14:30:45ZJanuary 15, 2025 2:30:45 PM (UTC)
US (month/day/year)MM/DD/YYYY01/15/2025January 15, 2025
UK (day/month/year)DD/MM/YYYY15/01/2025January 15, 2025
Long, with month nameDD MONTH YYYY15 January 2025January 15, 2025
European (day.month.year)DD.MM.YYYY15.01.2025January 15, 2025

Convert a column that mixes date formats

Choose Source - Custom (multiple formats) and enter several format codes separated by semicolons:

Format: YYYY-MM-DD; MM/DD/YYYY; DD.MM.YYYY

Mammoth tries each format in order until one works. This helps with data imported from several sources, history where the format changed over time, and inconsistent data entry.

Convert text to a number

Mammoth pulls the number out of formatted text. It strips a currency symbol in front of the number, comma thousand separators and a percent sign.

Input typeExampleResult
Plain number12341234
With decimals1234.561234.56
Currency prefix$1,234.561234.56
Negative with currency-$1,234.56-1234.56
Negative (leading)-1,234.56-1234.56
Negative (after the symbol)$-1,234.56-1234.56
Percentage45%45
Leading or trailing spaces" $1,234.56 "1234.56

Currency symbols Mammoth recognises

These 5 symbols are recognised and stripped when they come before the number:

SymbolCurrencyExample inputResult
$US Dollar$1,234.561234.56
€Euro€1,234.561234.56
£British Pound£1,234.561234.56
¥Japanese Yen / Chinese Yuan¥12341234
₹Indian Rupee₹1,234.561234.56

Thousand separators and European number formats

Mammoth removes comma thousand separators before converting. Standard grouping (1,234,567) and Indian-style grouping (12,34,567) both work. 1,234,567.89 and 1234567.89 both become 1234567.89.

European format isn't supported. Numbers that use a period as the thousand separator and a comma as the decimal (for example 1.234.567,89 or €1.234,56) aren't recognised and convert to empty. Use Find & Replace to change them to comma thousands and a period decimal first (1.234.567,89 → 1,234,567.89), then convert to Number.

Limits on converted numbers and timestamps

LimitValue
Decimal places stored after a text-to-number conversionUp to 8 (NUMERIC(38,8)). 1234.56789012345 is stored as 1234.56789012. Numbers are rounded to 8 decimal places.
Currency symbols recognised5: $, €, £, ¥, ₹, in front of the number only
Valid Unix timestamp range (seconds)-62,135,596,800 to 253,402,300,799

Convert a Unix timestamp to a date

When you convert a Number column to Date, Mammoth detects the time unit from the size of each value. You don't need to say which unit you have, because systems differ: JavaScript's Date.now() and Java's System.currentTimeMillis() return milliseconds (1735689600000), while Python's time.time() returns seconds (1735689600).

Value rangeDetected unitHow it's readExample inputResult
-62,135,596,800 to 253,402,300,799SecondsUnix timestamp (standard)17356896002025-01-01 00:00:00
-62,135,596,800,000 to 253,402,300,799,000MillisecondsDivided by 1,00017356896000002025-01-01 00:00:00
-62,135,596,800,000,000 to 253,402,300,799,000,000MicrosecondsDivided by 1,000,00017356896000000002025-01-01 00:00:00
-62,135,596,800,000,000,000 to 253,402,300,799,000,000,000NanosecondsDivided by 1,000,000,00017356896000000000002025-01-01 00:00:00
Outside all rangesNULL (invalid)99999999999999999999999(empty cell)

Two edge cases: 0 is read as seconds and gives 1970-01-01 00:00:00 (the Unix epoch start). -86400 gives 1969-12-31 00:00:00, one day before the epoch.

Check a conversion before you rely on it

  1. Test your format code on a few rows before you convert the whole column.
  2. Copy the column first with Copy Columns, so you can compare original and converted values.
  3. Try Source - Auto first for standard date formats (ISO, US, UK). Use format codes only if Auto fails.
  4. Don't use Auto for dates that could be day first or month first. Choose one.
  5. After converting, spot-check the first rows, the last rows and any empty cells.
  6. Remember text-to-number assumes a comma thousand separator and a period decimal point. Clean other conventions first.

Troubleshooting empty or wrong conversions

When a conversion fails, the cell becomes empty (NULL).

Text to date problems

ProblemCauseFix
All cells become emptyThe format code doesn't match your dataCheck the real date format in the source. Try Source - Auto first.
Some cells are emptySome values don't match the formatLook for typos, extra spaces or inconsistent formats in those rows.
"01/02/2025" reads wrongAmbiguous US or UK dateChoose Day First or Month First instead of Auto.
Extra text after the date ("2025-01-15 extra text")The format covers only the dateThat's fine: the format only needs to match the date part. Extra characters are ignored.
"2025-01-15 14:30:00" doesn't convertThe format has no time partUse YYYY-MM-DD HH24:MI:SS.

If Auto fails on a copy of the column, the data itself may have typos, mixed formats or invalid dates.

Text to number problems

ProblemCauseFix
All cells become emptyNo numbers found in the textCheck that the text contains numbers, not only words.
Some cells are emptyUnsupported currency symbol or formatOnly €, $, ¥, £ and ₹ are recognised.
"1,234.56€" failsCurrency symbol after the numberPut the symbol in front: "€1,234.56".
"1.234,56" failsEuropean formatUse Find & Replace to make it "1,234.56", then convert.
"25%" gives 25The % sign is strippedYou get the number. Convert to Percentage or format the result as a percentage if needed.

Number to date problems

ProblemCauseFix
All cells become emptyValues outside the valid timestamp rangeCheck the numbers. Valid range: -62,135,596,800 to 253,402,300,799 seconds.
Date is in 1970 when it should be 2025The unit was detected wronglyCheck the source system's convention (seconds or milliseconds).
Very old or future datesRead as a different unitCheck the input really is a Unix timestamp. Other numbers convert wrongly.
Was this page helpful?

Something wrong? support@mammoth.io