subx()

Read(9) Label: subtraction,

Description:

Perform subtraction operation on parameters.

Syntax:

subx(t1,t2)

Note:

Perform subtraction operation (t1 - t2) on parameters.

 

When t1 is a date/datetime value and t2 is a numeric value, t2 represents the day.

 

When t1 and t2 are of any of the other types, perform the subtraction operation the function originally aims.

Parameter:

t1 / t2

A value of date/time/datetime/numeric type.

Return value:

Date/time/datetime/time interval constant/numeric

Example:

 

A

 

1

=subx(date("2025-12-12"),date("2025-12-9"))

Compute the difference (the number of days) between two dates and return 3.

2

=cmpx(A1,itx(,3))

Compare A1’s time difference difference with 3 days and return 0.

3

=subx(time("01:01:01"),time("01:00:00"))

Find the time difference, which is 61 seconds.

4

=cmpx(A3,itx(61))

Compare A3’s time difference with 61 seconds and return 0.

5

=subx(datetime("2025-01-10 12:01:22"),5)

Compute the date by subtracting 5 days beginning from 2025-01-10 12:01:22 and return 2025-01-05 12:01:22.

6

=subx(3,8)

Compute the value of 3 minus 8 and return -5.

7

=subx(11,2)

Compute the value of 11 minus 2 and return 9.