Basic Functions
  • 31 May 2023
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

Basic Functions

  • Dark
    Light
  • PDF

Article Summary

$.math()

Allows you to perform mathematical operations such as ddition, subtraction, multiplication and division.

Examples

Calculates 1+1:

$.math(1+1)

Calculates the sum of parameters + 10:

$.math({{parameter_name}}+10)

Calculates the difference between two parameters:

$.math({{parameter_name1}}-{{parameter_name2}})

$.random(N)

$.random(N) - returns a random number depending on the specified N.

Where:

.random(N), N>1 - returns a positive random number;
$.random(N), N<0 - returns a negative random number.

N is larger than int64

If the N value is larger than int64, the int64 will be used instead.

$.sha1_hex

$.sha1_hex(content) - returns sha1 in hex from constant or task parameter if it is specified in {{parameter_name}} format

$.base64_encode

$.base64_encode(content) - convert constant or task parameter in base64 format, if it is specified in {{parameter_name}} format

content - constant or {{parameter_name}}

Date and time

$.unixtime()

Returns the current time in Unixtime in GMT 0.
You can use arithmetic arguments.

Examples

Returns current time in unixtime

$.unixtime()

Returns unixtime for current time + 60 min

$.unixtime(%y-%m-%d %h:%i+60:%s)

Returns unixtime for current date with set time 02:00:00

$.unixtime(%y-%m-%d 02:00:00)

$.date(%y-%m-%d %h:%i:%s)

Converts a date in 2015-02-04 16:19:33 format. You can use arithmetic arguments.

Examples

Returns the current date/time in yyyy-MM-dd HH:mm:SS format

$.date(%y-%m-%d %h:%i:%s)

add +1 day to the returned date in yyyy-MM-dd HH:mm:SS format

$.date(%y-%m-%d+1 %h:%i:%s)

$.unixtime.tz

Using the $.unixtime.tz function you can get the current time of a specific timezone.

Returns the current time in Kyiv (Eastern European timezone) in unixtime:

$.unixtime.tz("Europe/Kiev")
Timezones

For the list of timezones available for unixtime, see the file.

time_zones.txt