Equation functions and examples
Every function you can use in an Equation field, grouped into date, number, text and logic functions, each with a short example.
- Verified Nov 17, 2026
- Classic builder
On this page
These are the functions an Equation field accepts. They are database (MySQL) functions, so they behave as MySQL documents them. Type a function name in the equation editor to see its arguments and an example.
A function that is not on this page is rejected: the editor shows Unknown function name, and the builder will not save the field.
Date functions #
| Function | Returns |
|---|---|
ADDDATE(date, INTERVAL n unit) | The date plus an interval. ADDDATE(date, days) adds a number of days. |
ADDTIME(datetime, time) | The date/HH:MM:SS). |
CONVERT_TZ(datetime, from, to) | The date/ |
CURDATE() | Today's date. CURRENT_DATE() is the same. |
CURTIME() | The current time. CURRENT_TIME() is the same. |
DATE(datetime) | The date part of a date/ |
DATE_ADD(date, INTERVAL n unit) | The date plus an interval. |
DATE_FORMAT(date, format) | The date as text in the format you give (see the format codes below). |
DATE_SUB(date, INTERVAL n unit) | The date minus an interval. |
DATEDIFF(date1, date2) | The number of days from date2 to date1 (date1 minus date2). |
DAYNAME(date) | The weekday name. |
DAYOFMONTH(date) | The day of the month, 1 to 31. |
DAYOFWEEK(date) | The weekday number, 1 = Sunday to 7 = Saturday. |
DAYOFYEAR(date) | The day of the year, 1 to 366. |
EXTRACT(unit FROM date) | One part of a date, such as YEAR, MONTH or DAY. |
FROM_DAYS(n) | The date that is n days after year 0. |
FROM_UNIXTIME(timestamp) | The date/ |
GET_FORMAT(type, region) | A ready-made format string, for use in DATE_FORMAT. |
HOUR(datetime) | The hour, 0 to 23. |
LAST_DAY(date) | The last day of the date's month. |
MAKEDATE(year, day) | The date for a year and a day-of-year number. |
MAKETIME(hour, minute, second) | A time. |
MICROSECOND(datetime) | The microseconds part. |
MINUTE(datetime) | The minute, 0 to 59. |
MONTH(date) | The month number, 1 to 12. |
MONTHNAME(date) | The month name. |
NOW() | The current date and time. |
QUARTER(date) | The quarter, 1 to 4. |
SECOND(datetime) | The second, 0 to 59. |
STR_TO_DATE(text, format) | A date read from text in the format you give. |
SUBDATE(date, INTERVAL n unit) | The date minus an interval. SUBDATE(date, days) subtracts days. |
SUBTIME(datetime, time) | The date/ |
TIME(datetime) | The time part of a date/ |
TIMEDIFF(time1, time2) | The time between two times or date/ |
WEEK(date[, mode]) | The week number, 0 to 53. mode sets which day starts the week. |
WEEKDAY(date) | The weekday number, 0 = Monday to 6 = Sunday. |
WEEKOFYEAR(date) | The calendar week, 1 to 53. |
YEAR(date) | The year. |
YEARWEEK(date[, mode]) | The year and week number together. |
Examples:
ADDDATE('2017-06-15', INTERVAL 10 DAY) → 2017-06-25
ADDTIME('2017-06-15 09:34:21', '00:00:02') → 2017-06-15 09:34:23
CONVERT_TZ('2024-12-24 14:28:17', '+05:30', '+00:00') → 2024-12-24 08:58:17
CURDATE() → 2024-12-24
CURTIME() → 14:28:17
DATE('2024-12-24 14:28:17') → 2024-12-24
DATE_ADD({Start Date}, INTERVAL 30 DAY)
DATE_FORMAT('2024-06-15', '%M %d, %Y') → June 15, 2024
DATE_SUB('2024-06-15', INTERVAL 10 DAY) → 2024-06-05
DATEDIFF('2025-08-30', '2025-08-25') → 5
DAYNAME('2024-12-24') → Tuesday
DAYOFMONTH('2025-04-07') → 7
DAYOFWEEK('2024-12-24') → 3
DAYOFYEAR('2024-12-24') → 359
EXTRACT(MONTH FROM '2024-06-15') → 6
FROM_DAYS(738000)
FROM_UNIXTIME(1703425697)
DATE_FORMAT('2020-12-25', GET_FORMAT(DATE, 'USA')) → 12.25.2020
HOUR('2025-04-29 14:48:23') → 14
LAST_DAY('2024-12-24') → 2024-12-31
MAKEDATE(2024, 358) → 2024-12-23
MAKETIME(14, 28, 17) → 14:28:17
MICROSECOND('2025-04-29 14:48:23.000023') → 23
MINUTE('2025-04-29 14:48:23') → 48
MONTH('2024-12-24') → 12
MONTHNAME('2024-12-24') → December
NOW() → 2025-04-29 17:30:00
QUARTER('2024-12-24') → 4
SECOND('2025-04-29 12:45:32') → 32
STR_TO_DATE('August 10 2024', '%M %d %Y') → 2024-08-10
SUBDATE('2024-12-24', INTERVAL 10 DAY) → 2024-12-14
SUBTIME('2024-12-24 14:28:17', '01:00:00') → 2024-12-24 13:28:17
TIME('2024-12-24 14:28:17') → 14:28:17
TIMEDIFF('14:28:17', '01:00:00') → 13:28:17
WEEK('2024-12-24') → 51
WEEKDAY('2024-12-24') → 1
WEEKOFYEAR('2024-12-24') → 52
YEAR('2017-06-15') → 2017
YEARWEEK('2024-12-24') → 202451 Interval units for DATE_ADD, DATE_SUB, ADDDATE and SUBDATE include SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER and YEAR.
Common DATE_FORMAT and STR_TO_DATE codes: %Y year (2024), %m month (01–12), %M month name, %b short month name, %d day (01–31), %W weekday name, %a short weekday name, %H hour (00–23), %h hour (01–12), %i minutes, %s seconds, %p AM or PM.
NOW(), CURDATE() and CURTIME() return the app's current date and time when the record is calculated. The stored result does not change by itself afterwards.
Number functions #
| Function | Returns |
|---|---|
ABS(n) | The value without its sign. |
ACOS(n), ASIN(n), ATAN(n) | Arc cosine, arc sine and arc tangent, in radians. |
ATAN2(y, x) | The arc tangent of y/ |
CEIL(n) | The smallest whole number not less than n. CEILING(n) is the same. |
CONV(n, from_base, to_base) | The number converted between bases, as text. |
COS(n), SIN(n), TAN(n), COT(n) | Cosine, sine, tangent and cotangent of an angle in radians. |
CRC32(text) | A checksum of the text. |
DEGREES(n) | Radians converted to degrees. |
EXP(n) | e raised to the power n. |
FLOOR(n) | The largest whole number not greater than n. |
MOD(n, divisor) | The remainder after dividing. |
PI() | The value of pi. |
POWER(base, exponent) | base raised to exponent. |
RADIANS(n) | Degrees converted to radians. |
RAND() | A random number from 0 up to, but not including, 1. |
ROUND(n[, decimals]) | n rounded to a whole number, or to decimals places. |
SIGN(n) | -1, 0 or 1 for a negative, zero or positive number. |
SQRT(n) | The square root. |
TRUNCATE(n, decimals) | n cut to decimals places without rounding. |
Examples:
ABS(-12.7) → 12.7
ACOS(1) → 0
ATAN2(0, 1) → 0
CEIL(25.75) → 26
CONV(255, 10, 2) → 11111111
COS(PI()) → -1
CRC32('check')
DEGREES(PI()) → 180
EXP(0) → 1
FLOOR(25.75) → 25
MOD(17, 5) → 2
PI() → 3.141593
POWER(4, 2) → 16
RADIANS(180) → 3.141592653589793
FLOOR(RAND() * 100)
ROUND(8.3438, 2) → 8.34
SIGN(-4) → -1
SQRT(49) → 7
TRUNCATE(135.375, 2) → 135.37 Text functions #
| Function | Returns |
|---|---|
CHAR(code) | The character for a character code. |
CHAR_LENGTH(text) | The number of characters. |
CONCAT(text1, text2, ...) | The values joined into one text. |
CONCAT_WS(separator, text1, text2, ...) | The values joined with a separator between them. |
FORMAT(n, decimals) | The number as text, rounded and with commas. |
HEX(n) | The hexadecimal form of a number or text. |
LEFT(text, n) | The first n characters. |
LENGTH(text) | The length in bytes. Accented letters and emoji count as more than one; use CHAR_LENGTH to count characters. |
LOCATE(find, text) | The position of the first match, or 0 if there is none. |
LOWER(text) | The text in lowercase. |
LPAD(text, length, pad) | The text padded on the left to length characters. |
LTRIM(text) | The text without leading spaces. |
MID(text, start, length) | Part of the text from a position. SUBSTRING is the same. |
REPEAT(text, count) | The text repeated count times. |
REPLACE(text, find, replace_with) | The text with every match replaced. Matching is case-sensitive. |
REVERSE(text) | The characters in reverse order. |
RIGHT(text, n) | The last n characters. |
RPAD(text, length, pad) | The text padded on the right to length characters. |
RTRIM(text) | The text without trailing spaces. |
SPACE(n) | n spaces. |
STRCMP(text1, text2) | 0 if the texts are equal, -1 if the first sorts first, 1 otherwise. |
SUBSTRING(text, start, length) | Part of the text from a position. |
SUBSTRING_INDEX(text, delimiter, count) | The text before the count-th delimiter; a negative count takes the part after it, counting from the end. |
TRIM(text) | The text without leading or trailing spaces. |
UPPER(text) | The text in uppercase. |
WEIGHT_STRING(text) | The binary sort key the database uses to compare the text. Rarely needed. |
Examples:
CHAR(97) → a
CHAR_LENGTH('Build Fast!') → 11
CONCAT({First Name}, ' ', {Last Name}) → John Doe
CONCAT_WS('-', 'Tadabase', 'App', 'Builder') → Tadabase-App-Builder
FORMAT(98765.4321, 1) → 98,765.4
HEX(100) → 64
LEFT('Developer Tools', 9) → Developer
LENGTH('Data Builder') → 12
LOCATE('Dev', 'Developer') → 1
LOWER('WELCOME') → welcome
LPAD('7', 3, '0') → 007
LTRIM(' Tadabase') → Tadabase
MID('Tadabase is cool', 13, 4) → cool
REPEAT('ab', 3) → ababab
REPLACE({Sales Rep}, 'Edward', 'Eddie')
REVERSE('Hello World') → dlroW olleH
RIGHT('Tadabase Magic', 5) → Magic
RPAD('7', 3, '0') → 700
RTRIM('Tadabase ') → Tadabase
CONCAT({City}, SPACE(1), {State})
STRCMP('apple', 'banana') → -1
SUBSTRING('Tadabase', 4, 3) → aba
SUBSTRING_INDEX('tadabase.com', '.', 1) → tadabase
TRIM(' Hello World! ') → Hello World!
UPPER({Customer})
WEIGHT_STRING('abc') Put text values in quotes, for example 'Paid'. Use CONCAT to join a field with fixed text: CONCAT('Order #', {Order Number}).
Logic: IF and comparisons #
| Function or operator | Returns |
|---|---|
IF(condition, value_if_true, value_if_false) | The second argument when the condition is true, otherwise the third. |
=, <> or !=, >, <, >=, <= | Compare two values. |
&& (and), || (or) | Combine conditions. |
Examples:
IF({Total Cost} <= 100, {Total Cost} + 5, {Total Cost})
IF({Status} = 'Paid' && {Amount} > 0, 'Settled', 'Open')
IF({Score} >= 90, 'A', IF({Score} >= 80, 'B', 'C')) More about conditions, nesting and fixing long statements: Use IF statements.
Combined examples #
Show a Date Range as one line of text.
CONCAT(DATE_FORMAT({Date Range - Start Date}, '%M %d, %Y'), ' - ', DATE_FORMAT({Date Range - End Date}, '%M %d, %Y')) Count the days in a Date Range, including both ends.
DATEDIFF({Date Range - End Date}, {Date Range - Start Date}) + 1 Check whether a field is blank.
IF(CHAR_LENGTH({Notes}) > 0, 'Has notes', 'No notes') Show a formatted price depending on an option.
IF({Sale/Rent} = 'For Sale', CONCAT('$', FORMAT({Sales Price}, 2)), CONCAT('$', FORMAT({Rent Per Month}, 2))) Count how many times a letter appears in a text.
(CHAR_LENGTH({Codes}) - CHAR_LENGTH(REPLACE({Codes}, 'A', ''))) / CHAR_LENGTH('A') Make a random code of three letters and two digits. Use a Text output. The value is created when the record is calculated and changes each time it is calculated again.
CONCAT(CHAR(FLOOR(65 + RAND() * 26)), CHAR(FLOOR(65 + RAND() * 26)), CHAR(FLOOR(65 + RAND() * 26)), FLOOR(10 + RAND() * 90)) Was this page helpful?
Something wrong or missing on this page? Tell us.