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

Convert text to numbers and Unix timestamps to dates

Convert Column Type to Number pulls the number out of formatted text, and Number to Date reads Unix timestamps. When a value can't be converted, the cell becomes empty (NULL). For the task's steps and settings, see Convert text to dates and numbers.

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.

Troubleshooting text to number conversions

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.

Troubleshooting Unix timestamp conversions

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