Updated on 2024-06-25 GMT+08:00

Obtaining a Specified Timestamp

Function Name

$getTimeBeforeHour(doubleA)

Function Description

Obtains the timestamp of the time that is A hours ago. The timestamp is the total number of milliseconds from 1970-01-01 00:00:00 to the specified time.

Parameter A in the function supports the following types:

  • Numbers
  • Local parameters
  • Other built-in functions

Application Scenarios

The function for obtaining the specified timestamp can be used in the following scenarios for API automation:

  • Request URL
  • Request header
  • Request body
  • Checkpoint property
  • if condition
  • for loop interrupt condition

Example

  • Request URL

    As shown in the following figure, the value of test in the request URL is the function for obtaining the specified timestamp. Parameter A in the function is 3.

  • Request header

    As shown in the following figure, the value of time in the request header is the function for obtaining the specified timestamp. Parameter A in the function is 3.

  • Request body

    As shown in the following figure, the request body uses the function for obtaining the specified timestamp. Parameter A in the function is the binary addition operation $add(2,2).

  • Checkpoint property

    As shown in the following figure, the target value of the checkpoint property result is the function for obtaining the specified timestamp. Parameter A in the function is the local parameter test. For details about how to set local parameters, see Local Parameters.

  • if condition

    As shown in the following figure, the target value of the if condition is the function for obtaining the specified timestamp. Parameter A in the function is the environment variable time. For details about how to set environment parameters, see Setting Environment Parameters.

  • for loop interrupt condition

    As shown in the following figure, the target value of the for loop interrupt condition is the function for obtaining the specified timestamp. Parameter A in the function is 3.