Type conversion

<< Click to Display Table of Contents >>

Current:  Create Calculated Field > Calculated Field Functions List 

Type conversion

Previous pageReturn to chapter overviewNext page

Functions

Syntax

Instructions

Examples

formatDate

formatDate(date, pattern)

Converts the date and time to a string in the specified format

For example:

If col ['order_date'] is 2020-02-17

formatDate(col['order_date'], 'dd/M/yy') = 17/2/20

formatNumber

formatNumber(num, pattern)

Converts a number to a string in the specified format

For example:

If col ['value'] is 3.1415926

formatNumber(col ['value'], '#. ##') = 3.14

parseDate

parseDate(string, pattern)

Converts a string to a date and time in the specified format, as opposed to formatDate

For example:

If col ['order_date'] is 2020-02-17

parseDate(col['order_date'], 'YYYY-MM-dd') = 2020-02-17 00:00:00

parseFloat

parseFloat(str)

Converts a string to a floating point number

For example:

If col ['value'] is "333.33"

parseDate(col ['value']) = 333.33

parseInt

parseInt(str)

Converts a string to an integer

For example:

if col ['value'] is "333.6"

parseInt(col ['value']) = 333

str

str(expression)

Converts the data type of a column to a string

For example:

str(col ['profit']) will return data for this column as a string