How-to
Short answer: dateFromText reads year-first dates only. Rearrange day-first text into year/month/day with a helper field, then convert it.
Why it happens
Datefromtextexpects the year first, as inDatefromtext("1970/05/29"). It has no day-first option.- An epoch number counts seconds from 1 January 1970, so it needs arithmetic, not a text conversion.
How to fix it
To convert DD/MM/YYYY text:
- Keep the text date in a text field, for example
Date_in_text. - Add a helper text field computed as
concatenate(Date_in_text.substring(7,10), "/", Date_in_text.substring(4,5), "/", Date_in_text.substring(1,2)). This turns 29/05/1970 into 1970/05/29. - In a Date field, use
dateFromText(Helper_Field).
substring(start, end) counts from 1 and includes both ends. See text expressions.
To convert an epoch number:
- In a Date field, use
Date(1970, 1, 1) + (Epoch_Field / 86400).rounddown(). Adding a number to a date adds days. - If the value is in milliseconds, divide by 86400000 instead.
Important
If you validate text dates with a regex, remove any leading or trailing spaces from the expression.
