Conversion group

1. Duration

Description

Transform a string into a duration type represented by a period of time (days, hours, minutes, seconds and milliseconds).

Format

duration(arg_1) → result

  • arg_1 : String
  • result : Float

Examples

  Example 1

duration('1 day')

    • arg_1 : 1 day
    • result : 1d
  Example 2

 duration('2 days 50 min 1 sec 8')

    • arg_1 : 2 days 50 min 1 sec 8
    • result : 2d50m1s8
  Example 3

  duration('32 h 61 min 80 sec 8')

    • arg_1 : 32 h 61 min 80 sec 8
    • result : 1d9h2m20s8
  Example 4

  duration('15 2s1min')

    • arg_1 : 15 2s1min
    • result : 1m2s15
  List of formats

The accepted format consists of numbers and the corresponding suffixes, except milliseconds, which have no suffix.

Days (0...n) days → (0...n)d
Hours (0...n) hours → (0...23)h
Minutes (0...n) minutes → (0...59)m
Seconds (0... n) seconds → (0...59)s
Miliseconds (0...n) → (0...999)

The duration will be automatically displayed in the most optimized time categorization accepted by the system (days, hours, minutes, seconds and milliseconds).

2. Format date

Description

Format a date using a custom format, optionally specifying time zone and locale.

See parse date for more information on the format syntax.

Format

formatdate(arg_1, arg_2[, arg_3[, arg_4]]) → result

  • arg_1 : Timestamp
  • arg_2 : String — Date format
  • arg_3 : String — Time zone (optional)
  • arg_4 : String — Locale (optional)
  • result : Timestamp

Examples

  Example 1

formatdate(timestamp("2017-01-23 13:10:15.123"), "MMM DD YYYY H:mm:ss.SSS A")

    • arg_1 : 2017-01-23 13:10:15.123
    • arg_2 : MMM DD YYYY h:mm:ss.SSS A
    • result : Jan 23 2017 13:10:15.123 PM
  Example 2

formatdate(timestamp("2017-02-01 00:59:59.000"), "DD/MM/YYYY HH:mm:ss", "GMT+1", "es-ES")

    • arg_1 : 2017-02-01 00:59:59.000
    • arg_2 : DD/MM/YYYY HH:mm:ss
    • arg_3 : GMT+1
    • arg_4 : es-ES
    • result : 31/01/2017 23:59:59

String to timestamp conversion is implicit while using the operations dialogue box, so there is no need to do it explicitly as in the previous examples.

3. From UTF8

Description

Returns an UTF8 string from the given byte array. For more information about byte arrays, please see the make byte array function.

Format

fromutf8(arg_1) → result

  • arg_1 : byte array
  • result : String

Examples

  Example 1

fromutf8(616263)

    • arg_1 : 616263
    • result : abc
  Example 2

fromutf8(68656C6C6F20776F726C64)

    • arg_1 : 68656C6C6F20776F726C64
    • result : hello world

4. From Z85

Description

Creates a byte array from a valid Z85 string. For more information about byte arrays, please see the make byte array function.

Format

fromz85(arg_1) → result

  • arg_1 : String
  • result : byte array

Examples

  Example 1

fromz85("axtD")

    • arg_1 : axtD
    • result : 616263
  Example 2

fromz85("xK#0@zY<mxch)^")

    • arg_1 : xK#0@zY<mxch)^
    • result : 68656C6C6F20776F726C64

5. From base16, b16, hex

Description

Creates a byte array from a valid hexadecimal (base16) string. For more information about byte arrays, please see the make byte array function.

Format

from16(arg_1) → result

  • arg_1 : String
  • result : byte array

Examples

  Example 1

from16("616263")

    • arg_1 : 616263
    • result : 616263
  Example 2

from16("4a4b4c")

    • arg_1 : 4a4b4c
    • result : 4A4B4C

6. From base64, b64

Description

Creates a byte array from a valid base64 string. For more information about byte arrays, please see the make byte array function.

Format

from64(arg_1) → result

  • arg_1 : String
  • result : byte array

Examples

  Example 1

from64("YWJj")

    • arg_1 : YWJj
    • result : 616263
  Example 2

from64("aGVsbG8gd29ybGQ=")

    • arg_1 : aGVsbG8gd29ybGQ=
    • result : 68656C6C6F20776F726C64

7. Human size

Description

Converts a number into a human-readable format, using a binary prefix by default. It the second argument is used: true is for binary prefix (2x) and false for decimal prefix (10x).

Format

humanSize(arg_1[, arg_2]) → result

  • arg_1 : Integer
  • arg_2 : Boolean (optional)
  • result : String

Examples

  Example 1

humanSize(1024) 

    • arg_1: 1024
    • result : 1KiB
  Example 2

humanSize(1024, false) 

    • arg_1: 1024
    • result : 1.02KB
  Example 3

humanSize(17592186044416, true) 

    • arg_1 : 17592186044416
    • arg_2 : true
    • result : 16TiB
  Example 4

humanSize(17592186044416, false) 

    • arg_1 : 17592186044416
    • arg_2 : true
    • result : 17.59TB

8. Make byte array

Description

Creates a byte array from the given numerical values.A byte array is represented by a hexadecimal string to make it readable, but it is not a string.

Format

mkboxar(args) → result

  • args : Integer (one or more)
  • result : byte array

Examples

  Example 1

mkboxar(65)

    • arg_1 : 65
    • result : 41
  Example 2

mkboxar(97, 98, 99)

    • arg_1 : 97
    • arg_2 : 98
    • arg_3 : 99
    • result : 616263

9. Parse date

Description

Parse a date using a custom format, optionally specifying time zone and locale.

Format

  parsedate(arg_1, arg_2[, arg_3[, arg_4]]) → result
  • arg_1 : String — String to be parsed
  • arg_2 : String — Date format
  • arg_3 : String — Time zone (optional)
  • arg_4 : String — Locale (optional)
  • result : Timestamp

Examples

  Example 1

parsedate("Jan 23 2017, 1:15:00.123", "MMM DD YYYY H:mm:ss.SSS A")

    • arg_1 : Jan 23 2017, 1:15:00.123
    • arg_2 : MMM DD YYYY H:mm:ss.SSS A
    • result : 2017-01-23 13:10:15.000
  Example 2

parsedate("31/01/2017 23:59:59", "DD/MM/YYYY HH:mm:ss", "GMT+1", "es-ES")

    • arg_1 : 31/01/2017 23:59:59
    • arg_2 : DD/MM/YYYY HH:mm:ss
    • arg_3 : GMT+1
    • arg_4 : es-ES
    • result : 2017-02-01 00:59:59.000

It parses a date using a custom format, optionally specifying time zone and locale. Format must be specified using the following patterns:

  Format patterns
YY YYYY Year (15, 2015)
M MM MMM MMMM Month (7, 07, Jul, July)
D DD Day in month (9, 09)
H HH Hour (0...23, 00...23)
h hh Hour (1...12, 01...12)
A AM/PM
m mm Minute (0...59, 00...59)
s ss Second (0...59, 00...59)
S SSS Millisecond (0...999, 000...999)
GG GGGG Weekyear (15, 2015)
W WW Week of weekyear (1...53, 01...53)
ZZ TimeZone offset (-0700, ...+0700)

To introduce a literal, the letters must be escaped. Escaping is done inserting the text in a '[', ']' pair. For example, [abc] → abc . Numbers and other symbols may or may not be escaped.

In the case of '[' and ']' symbols, the escaping rules are more complex. '[' only opens an escaped block if there is a closing ']' symbol before any other ']'. A closing ']' only closes an escaped block if there is no other closing ']' before the next opening '['.

The format must contain a year pattern.

If the format used does not adjust to this description, the result of the operation is not specified.

10. Regular expression

Description

Builds a regular expression from the given string pattern.

Format

re(arg_1) → result

  • arg_1 : String
  • result : Regexp

Examples

  Example 1

re('a*')

    • arg_1 : a*
    • result : a*
  Example 2

re('^([^@]+)@(.+)$')

    • arg_1 : ^([^@]+)@(.+)$
    • result : ^([^@]+)@(.+)$

11. Timestamp

Description

Converts an integer or a valid string (epoch) into normal date format. The string valid format should be Year-Month-Day Hour:Minute:Second.Millisecond, where all the fields are numbers. Epoch date should be in milliseconds.

Format

timestamp(arg_1) → result

  • arg_1 : Integer or String
  • result : Timestamp

Examples

  Example 1

timestamp("2017-01-23 13:10:15.123")

    • arg_1: 2017-01-23 13:10:15.123
    • result : 2017-01-23 13:10:15.123
  Example 2

timestamp("2017-02-01 00:59:59")

    • arg_1 : 2017-02-01 00:59:59
    • result : 2017-02-01 00:59:59.0

If a date string doesn't follow the specified format, it can also be converted to timestamp using parsedate.

12. Template

Description

Builds a template from the given string definition. A template is a replacement string that also admits capturing groups (for example \1 will use the capturing group 1 as a template).

Format

template(arg_1) → result

  • arg_1 : String
  • result : Template

Examples

  Example 1

template("name")

    • arg_1 : name
    • result : name
  Example 2

template("***")

    • arg_1 : ***
    • result : **
  Example 3

template("\1\2")

    • arg_1 : \1\2
    • result : \1\2

13. To Float

Description

Converts a valid number string or an integer into a float number.

Format

float(arg_1) → result

  • arg_1 : String or Integer
  • result : Float

Examples

  Example 1

float("123456.1234") 

    • arg_1 : 123456.1234 — String
    • result : 123456.1234
  Example 2

float("1234ABC") 

    • arg_1 : 1234ABC — String
    • result : null
  Example 3

float(1234) 

    • arg_1 : 1234 — Integer
    • result : 1234

14. To IP

Description

Converts a valid string or integer into an IP address (IPv4)

Format

ip4(arg_1) → result

  • arg_1 : String or Integer
  • result: IP address

Examples

  Example 1

ip4("10.0.0.1")

    • arg_1 : "10.0.0.1"
    • result : 10.0.0.1
  Example 2

ip4("1234abc")

    • arg_1 : 1234abc
    • result: null
  Example 3

ip4("400.123.1.1")

    • arg_1 : 400.123.1.1
    • result: null
  Example 4

ip4(167772161)

    • arg_1 : 167772161
    • result : 10.0.0.1
  Example 5

ip4(3627733955)

    • arg_1 : 3627733955
    • result : 216.58.211.195

15. To Image

Converts a string into an image.

16. To Int

Description

Converts a valid number string or a float into a integer number. Please note that float numbers are not rounded, so the result will be the integral part.

Format

int(arg_1) → result

  • arg_1 : String or Float
  • result : Integer

Examples

  Example 1

int("123456") 

    • arg_1 : 123456 — String
    • result : 123456
  Example 2

int("1234ABC") 

    • arg_1 : 1234ABC — String
    • result : null
  Example 3

int(1234.999) 

    • arg_1 : 1234.999 — Float
    • result : 1234
  Example 4

int(1234.11) 

    • arg_1 : 1234.11 — Float
    • result : 1234

17. To UTF8

Description

Creates a byte array from an UTF8 string. Please check above the make byte array function, for more information on byte array.

Format

toutf8(arg_1) → result

  • arg_1 : String
  • result : byte array

Examples

  Example 1

toutf8("abc")

    • arg_1 : abc
    • result : 616263
  Example 2

toutf8("hello world")

    • arg_1 : hello world
    • result : 68656C6C6F20776F726C64

18. To Z85, base85 

Description

Returns a Z85 string from the given byte array. Please check above the make byte array function, for more information on byte array.

Format

toz85(arg_1) → result

  • arg_1 : byte array
  • result : String

Examples

  Example 1

toz85(616263)

    • arg_1 : 616263
    • result : axtD
  Example 2

toz85(68656C6C6F20776F726C64)

    • arg_1 : 68656C6C6F20776F726C64
    • result : xK#0@zY<mxch)^

19. To base16, b16, hex

Description

Returns a hexadecimal (base16) string from the given byte array. Please check above the make byte array function, for more information on byte array.

Format

to16(arg_1) → result

  • arg_1 : byte array
  • result : String

Examples

  Example 1

to16(616263)

    • arg_1 : 616263
    • result : 616263
  Example 2

to16(4A4B4C)

    • arg_1 : 4A4B4C
    • result : 4A4B4C

20. To base64, b64

Description

Returns a base64 string from the given byte array. Please check above the make byte array function ,for more information on byte array.

Format

to64(arg_1) → result

  • arg_1 : byte array
  • result : String

Examples

  Example 1

to64(616263)

    • arg_1 : 616263
    • result : YWJj
  Example 2

to64(68656C6C6F20776F726C64)

    • arg_1 : 68656C6C6F20776F726C64
    • result : aGVsbG8gd29ybGQ=

21. To string

Description

Converts an integer, float, date, ip address and coordinates into a string.

Format

str(arg_1) → result

  • arg_1 : Integer, Float, Timestamp, IP, Geocoord
  • result : String

Examples

  Example 1

str(int("123"))

    • arg_1: int("123")
    • result : 123
  Example 2

str(float("123.456"))

    • arg_1: float(123.456)
    • result : 123
  Example 3

str(timestamp("2017-02-01 00:59:59"))

    • arg_1 : timestamp(2017-02-01 00:59:59)
    • result : 2017-02-01 00:59:59.0
  Example 4

str(ip4("192.168.1.1"))

    • arg_1: ip4("192.168.1.1")
    • result : 192.168.1.1
  Example 5

str(geocoord("40°24'46.2\"N 3°41'43.8\"W"))

    • arg_1: geocoord("40°24'46.2\"N 3°41'43.8\"W")
    • result : 40°24′46.2″N 3°41′43.8″W

Most of these conversions are implicit while using the operations dialogue box, so there is no need to do them explicitly or if the selected column has one of the supported types.


Have we answered your question?

If not, please contact our technical support team via email by clicking the button below.

CONTACT US