Skip to main content

Comparison Functions

This section describes the following comparison functions.

ge

ge(<number>|<string>|<date>, <number>|<string>|<date>)

ge returns true if the first value is greater than or equal to second value. Values must both be the same type. ge may appear when defining datasource fields or in validations.

Examples:

ge(2, 2) # true 
ge("hello", "world") # false, hello is lexicographically before world
ge(now, to_d("2015-11-10T11:10:06Z")) # true, current time is greater than supplied value

gt

gt(<number>|<string>|<date>, <number>|<string>|<date>)

gt returns true if the first value is greater than second value. Values must both be same type. gt may appear when defining datasource fields or in validations.

Examples:

gt(3, 2) # true 
gt("hello", "world") # false, hello is lexicographically before world
gt(now, to_d("2015-11-10T11:10:06Z")) # true, that date is in the past

le

le(<number>|<string>|<date>, <number>|<string>|<date>)

le returns true if value1 is less than or equal to value2. Values must both be same type. le may appear when defining datasource fields or in validations.

Examples:

le(2, 2) # true 
le("hello", "world") # true, hello is lexicographically before world
le(to_d("2015-11-10T11:10:06Z"), now) # true, that date is in the past

lt

lt(<number>|<string>|<date>, <number>|<string>|<date>)

lt returns true if value1 is less than value2. Values must both be same type. lt may appear when defining datasource fields or in validations.

Examples:

lt(2, 3) # true 
lt("hello", "world") # true, hello is lexicographically before world
lt(to_d("2015-11-10T11:10:06Z"), now) # true, that date is in the past

ne

ne(<number>|<string>|<date>, <number>|<string>|<date>)

ne returns true if first value is not equal to second value. Values must both be same type. ne may appear when defining datasource fields or in validations.

Examples:

ne(2, 3) # true 
ne("hello", "world") # true

eq

eq(<number>|<string>|<date>, <number>|<string>|<date>)

eq returns true if first value is equal to second value. Values must both be same type. eq may appear when defining datasource fields or in validations.

Examples:

eq(2, 2) # true 
eq(2, "2") # false, different types
eq("hello", "hello") # true
eq("hello", "HELLO") # false

now

now()

now returns the current time in UTC timezone. It accepts no parameters.

Example: