Function Expression
$w.ABS
$w.ABS(number:number):number
Feature Description
Calculate the absolute value of the input number.
$w.Min
$w.Min(...numbers: number[]):number
Feature Description
Returns the minimum value in a set of numbers.
$w.Max
$w.Max(...numbers: number[]):number
Feature Description
Returns the maximum value in a set of numbers.
$w.Average
$w.Average(...numbers: number[]):number
Feature Description
Returns the average of a set of numbers.
$w.Sum
$w.Sum(...numbers: number[]):number
Feature Description
Calculates the sum of a set of numbers.
$w.Floor
$w.Floor(number:number):number
Feature Description
Returns the floor of the input number.
Example
$w.Floor(1.1); // 1
$w.Floor(-1.1); // -2
$w.Ceiling
$w.Ceiling(number:number):number
Feature Description
Returns the ceiling of the input number.
Example
$w.Ceiling(1.1); // 2
$w.Ceiling(-1.1); // -1
$w.Round
$w.Round(number:number):number
Feature Description
Returns the rounded value of the input number.
$w.Rand
$w.Rand(number:number):number
Feature Description
Returns a pseudo-random integer within a specified range.
Example
$w.Rand(10); // 2
$w.Rand(-1); // 0
$w.If
$w.If(condition:boolean, consequent:any, alternate:any):any
$w.If(params: { condition:boolean; consequent:any; alternate:any}):any
Feature Description
Performs a logical comparison based on specified conditions, returning one value when conditions are met and another when they are not.
ps: This function includes two overloaded forms. The first accepts a parameter list with the arguments
condition
,consequent
, andalternate
; the second accepts only a single object parameter containing these three keys. Otherwise, there is no difference between them.
Input Parameters
condition:boolean
Triggering Conditions
consequent:any
When the condition is met, returns a value.
alternate:any
When the condition is not met, returns another value.
Example
$w.If(1 == 1, "Hello", "hello"); // "Hello"
$w.If({
condition: 1 == 1,
consequent: "Hello",
alternate: "hello",
}); // "Hello"
$w.IsEmpty
$w.IsEmpty(text: string | string[]): boolean
Feature Description
Determines whether the characters of the input value are empty; if the result is an array type, it also checks whether all items in the result array are empty.
Input Parameters
text: string | string[]
Value to be evaluated
Example
$w.IsEmpty("text"); // false
$w.IsEmpty(""); // true
$w.IsEmpty(null); // false
$w.IsEmpty(undefined); // false
$w.IsEmpty(0); // false
$w.And
$w.And(...args: boolean[]): boolean
Feature Description
Used to determine whether all conditions are true
$w.Or
$w.Or(...args: boolean[]): boolean
Feature Description
If any condition is true, the result is true; the result is false only when all conditions are false.
$w.DateText
$w.DateText(date:Timestamp, format:string): string
Feature Description
Format datetime to text in the specified format
Input Parameters
date:Timestamp
Date and time format data to be formatted (millisecond timestamp). Accepts any data that can be converted (via new Date
) to date format.
format:string
Format template. Supported placeholder list:
Placeholder | Formatted Output | Description |
---|---|---|
YY | 18 | Two-digit year |
YYYY | 2018 | Four-digit year |
M | 1-12 | Month, starting from 1 |
MM | 01-12 | Month, two-digit |
D | 1-31 | Day of the month |
DD | 01-31 | Day of the month, two-digit |
d | 0-6 | Day of the week, with Sunday as 0 |
H | 0-23 | Hour |
HH | 00-23 | Hour, two-digit |
m | 0-59 | Minute |
mm | 00-59 | Minutes, two-digit |
s | 0-59 | Second |
ss | 00-59 | Seconds, two-digit |
SSS | 000-999 | Milliseconds, three-digit |
Z | +05:00 | UTC offset, ±HH:mm |
ZZ | +0500 | UTC offset, ±HHmm |
Response Parameters
string
Formatted date-time string
Example
$w.DateText(Date.now(), "YYYY-MM-DD HH:mm:ss"); //'2022-12-26 11:54:33'
$w.DateTimeValue
$w.DateTimeValue(dateString: string, format: string): number
Feature Description
Converts date-time text to a datetime object according to the specified format, for example DateTimeValue("2021-12-11 01:19:12", "YYYY-MM-DD HH:mm:ss")
Input Parameters
dateString: string
Text datetime
format: string
Convert the time format
Example
$w.DateTimeValue("2011-07-02", "YYYY:MM:DD"); // 1309536000000
$w.Now
$w.Now(): number
Feature Description
Returns the current system time, typically used in combination with other date-time functions.
Example
$w.Now(); // 1309536000000
$w.GetDate
$w.GetDate(year: number, month: number, day: number): number
Feature Description
Based on the input year, month, and day values, returns a date-type value, for example GetDate(2017,3,24)
Input Parameters
year: number
Year
month: number
Month, starting from 0
day: number
Day
Response Parameters
number
Returned datetime (numeric millisecond timestamp)
$w.Timestamp
$w.Timestamp(date: number | string | Date): number
Feature Description
Returns a timestamp based on the input date and time
Input Parameters
date: number | string | Date
Time to be converted
Response Parameters
number
Returned timestamp
Example
$w.Timestamp(new Date("2011-07-02")); // 1309564800000
$w.Second
$w.Second(date: number | string | Date): number
Feature Description
Returns the number of seconds for the input date and time
Input Parameters
date: number | string | Date
Time to be retrieved
Response Parameters
number
Returned seconds
Example
$w.Second(new Date("2011-07-02")); //0
$w.Minute
$w.Minute(date: number | string | Date): number
Feature Description
Returns the minute of the input date and time.
Input Parameters
date: number | string | Date
Time to be retrieved
Response Parameters
number
Returned minutes
Example
$w.Minute(new Date("2011-07-02 12:22:32")); // 22
$w.Hour
$w.Hour(date: number | string | Date): number
Feature Description
Returns the hour of the input date and time in 24-hour format.
Input Parameters
date: number | string | Date
Time to be retrieved
Response Parameters
number
Returned hours
Example
$w.Hour(new Date("2011-07-02 12:22:32")); // 12
$w.Day
$w.Day(date: number | string | Date): number
Feature Description
Returns the day of the month for the input date and time, in the range of 1-31.
Input Parameters
date: number | string | Date
Time to be retrieved
Response Parameters
number
Returned days
Example
$w.Day(new Date("2011-07-02")); // 2
$w.DayOfWeek
$w.DayOfWeek(date: number | string | Date): number
Feature Description
Returns the day of the week for the input date and time
Input Parameters
date: number | string | Date
Time to be retrieved
Response Parameters
number
Returned day of the week
Example
$w.DayOfWeek(new Date("2011-07-02 12:22:32")); // 6
$w.Month
$w.Month(date: number | string | Date): number
Feature Description
Returns the month of the input date and time
Input Parameters
date: number | string | Date
Time to be retrieved
Response Parameters
number
Returned month
Example
$w.Month(new Date("2011-07-02 12:22:32")); // 7
$w.Year
$w.Year(date: number | string | Date): number
Feature Description
Returns the year of the input date and time
Input Parameters
date: number | string | Date
Time to be retrieved
Response Parameters
number
Returned year
Example
$w.Year(new Date("2011-07-02")); // 2011
$w.Age
$w.Age(date1: number | string | Date, date2: number | string | Date): number
Feature Description
Calculates the age based on two input date and time values (by calculating the year as an integer based on 365 days per year), for example $w.Age($w.GetDate(2017, 3, 24), $w.GetDate(2021, 3, 24))
.
Input Parameters
date1: number | string | Date
Birth time
date2: number | string | Date
Specified computation time
Response Parameters
number
Returned age
Example
$w.Age($w.GetDate(2011, 6, 2), $w.GetDate(2012, 8, 2)); // 1
$w.Age($w.GetDate(2011, 6, 2), $w.GetDate(2012, 5, 2)); // 0
$w.AgeOfNow
$w.AgeOfNow(date: number | string | Date): number
Feature Description
Calculates the age based on the birth time and current time (by calculating the year as an integer based on 365 days per year), for example $w.AgeOfNow($w.GetDate(2017,3,24))
.
Age increases by one year only when a full year is completed.
Input Parameters
date: number | string | Date
Birth time
Response Parameters
number
Returned age
Example
$w.DateText($w.Now(), "YYYY-MM-DD"); // assuming today is 2023-01-05
$w.AgeOfNow($w.GetDate(2011, 6, 2)); // 11
$w.AgeOfNow($w.GetDate(2012, 1, 4)); // 11
$w.DateAdd
$w.DateAdd(date: number | string | Date, days: number): number
Feature Description
Adds X days to the input date and time, supporting negative values.
Input Parameters
date: number | string | Date
Input date
days: number
Added days
Response Parameters
number
Returned date
Example
$w.DateAdd(1309536000000, 1); // 1309622400000
$w.MonthAdd
$w.MonthAdd(date: number | string | Date, months: number): number
Feature Description
Adds X months to the input date and time, supporting negative values.
Input Parameters
date: number | string | Date
Input date
months: number
Added months
Response Parameters
number
Returned date
Example
$w.MonthAdd(1309536000000, 1); // 1312214400000
$w.YearAdd
$w.YearAdd(date: number | string | Date, years: number): number
Feature Description
Adds X years to the input date and time, supporting negative values.
Input Parameters
date: number | string | Date
Input date
years: number
Added years
Response Parameters
number
Returned date
Example
$w.YearAdd(1309536000000, 1); // 1341158400000
$w.YearDiff
$w.YearDiff(startDate: number | string | Date, endDate: number | string | Date): number
Feature Description
Returns the difference in years between two date-time fields. If they are in the same year, the difference is zero.
Input Parameters
startDate: number | string | Date
Comparison start date
endDate: number | string | Date
Comparison end date
Response Parameters
number
Returned integer difference in years
Example
$w.YearDiff($w.GetDate(1980, 3, 24), $w.GetDate(1981, 3, 25)); // 1
$w.MonthDiff
$w.MonthDiff(startDate: number | string | Date, endDate: number | string | Date): number
Feature Description
Returns the difference in months between two date-time fields. If they are in the same month, the difference is zero.
Input Parameters
startDate: number | string | Date
Comparison start date
endDate: number | string | Date
Comparison end date
Response Parameters
number
Returned integer difference in months
Example
$w.MonthDiff($w.GetDate(1980, 3, 24), $w.GetDate(1981, 3, 25)); // 12
$w.DateDiff
$w.DateDiff(startDate: number | string | Date, endDate: number | string | Date): number
Feature Description
Returns the difference in days between two date-time fields. If they are on the same day, the difference is zero.
Input Parameters
startDate: number | string | Date
Comparison start date
endDate: number | string | Date
Comparison end date
Response Parameters
number
Returned integer difference in days
Example
$w.DateDiff($w.GetDate(1980, 3, 24), $w.GetDate(1981, 3, 25)); // 366
$w.HourDiff
$w.HourDiff(startDate: number | string | Date, endDate: number | string | Date): number
Feature Description
Returns the difference in hours between two date-time fields. If they are in the same hour, the difference is zero.
Input Parameters
startDate: number | string | Date
Comparison start date
endDate: number | string | Date
Comparison end date
Response Parameters
number
Returned integer difference in hours
Example
$w.HourDiff($w.GetDate(1980, 3, 24), $w.GetDate(1981, 3, 25)); // 8784
$w.MinuteDiff
$w.MinuteDiff(startDate: number | string | Date, endDate: number | string | Date): number
Feature Description
Returns the difference in minutes between two date-time fields. If they are in the same minute, the difference is zero.
Input Parameters
startDate: number | string | Date
Comparison start date
endDate: number | string | Date
Comparison end date
Response Parameters
number
Returned integer difference in minutes
Example
$w.MinuteDiff($w.GetDate(1980, 3, 24), $w.GetDate(1980, 3, 25)); // 1440
$w.SecondDiff
$w.SecondDiff(startDate: number | string | Date, endDate: number | string | Date): number
Feature Description
Returns the difference in seconds between two date-time fields. If they are in the same second, the difference is zero.
Input Parameters
startDate: number | string | Date
Comparison start date
endDate: number | string | Date
Comparison end date
Response Parameters
number
Returned integer difference in seconds
Example
$w.SecondDiff($w.GetDate(1980, 3, 24), $w.GetDate(1980, 3, 25)); // 86400
$w.IsToday
$w.IsToday(date: number | string | Date): boolean
Feature Description
Determines whether the passed date-time is today, for example $w.IsToday($w.GetDate(2022,4,8))
Input Parameters
date: number | string | Date
Date to be evaluated
Response Parameters
boolean
Whether it is today's result
Example
$w.IsToday($w.GetDate(2021, 4, 8)); // false
$w.TimeText
$w.TimeText(time:number, format:string): string
Feature Description
Format time to text in the specified format
Input Parameters
time:number
The time to be formatted, in ms, is calculated as (hours 60 60 + minutes 60) 1000.
format:string
Format template. Supported placeholder list:
Placeholder | Formatted Output | Description |
---|---|---|
H | 0-23 | Hour |
HH | 00-23 | Hour, two-digit |
m | 0-59 | Minute |
mm | 00-59 | Minutes, two-digit |
s | 0-59 | Second |
ss | 00-59 | Seconds, two-digit |
SSS | 000-999 | Milliseconds, three-digit |
Response Parameters
string
Formatted time string
Example
$w.TimeText(28800000, "HH:mm"); //'08:00'
$w.Len
$w.Len(text: string): number
Feature Description
Get the character count of the input text. Equivalent to 'text'.length
Input Parameters
text: string
String to be computed
Response Parameters
number
String character length
Example
$w.Len("WeDa Low-Code"); // 5
$w.Contains
$w.Contains(text1: string, text2: string): boolean
Feature Description
Check if text 1 contains text 2
Input Parameters
text1: string
Text 1. Parent string
text2: string
Text 2. Substring
Response Parameters
boolean
Whether text 1 contains text 2
Example
$w.Contains("1123123123", "12"); // true
$w.Split
$w.Contains(text: string, separator: string): string[]
Feature Description
Based on the input text 2, split text 1 into a text array, for example $w.Split("Zhang San,Li Si,Wang Wu", ",")
Input Parameters
text: string
String to be split
separator: string
Delimiter string
Response Parameters
string[]
Split string array
Example
$w.Split("Hello,My World,I'm here", ","); // ['Hello','My World','I'm here']
$w.Trim
$w.Trim(text: string): string
Feature Description
Remove all spaces and tabs at the beginning and end of the text, while preserving those in the middle.
Input Parameters
text: string
Text to be processed
Response Parameters
string
Trimmed string
Example
$w.Trim(" WeDa Low-Code s "); // "WeDa Low-Code s"
$w.Upper
$w.Upper(text: string): string
Feature Description
Converts the input letters to uppercase text.
Input Parameters
text: string
Text to be processed
Response Parameters
text: string
Converted text
Example
$w.Upper("abc"); // "ABC"
$w.Lower
$w.Lower(text: string): string
Feature Description
Converts the input text to lowercase text.
Input Parameters
text: string
Text to be processed
Response Parameters
text: string
Converted text
Example
$w.Lower("ABC"); // "abc"
$w.Concat
$w.Concat(...text: string[])
Feature Description
Returns a new text concatenated from multiple input texts.
Input Parameters
...text: string[]
Response Parameters
string
Concatenated result
Example
$w.Concat("WeDa", "Low-Code"); // WeDa Low-Code