Converting a Date into a Timestamp
Function Name
$dateFormat(String A)
Parameter Description
String A: date and time value. The following formats are supported:
- yyyy-MM-dd HH:mm:ss or MM-dd-yyyy HH:mm:ss
- yyyy MM dd HH:mm:ss or MM dd yyyy HH:mm:ss
- yyyy.MM.dd HH:mm:ss or MM.dd.yyyy HH:mm:ss
- yyyy/MM/dd HH:mm:ss or MM/dd/yyyy HH:mm:ss
Function Description
Converts a string into a timestamp. 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:
- Date and time in the format listed in Parameter Description
- Environment parameters
- Local parameters
- Other built-in functions
Application Scenarios
The date-to-timestamp function 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 date-to-timestamp conversion function. Parameter A in the function is the environment parameter date. For details about how to set environment parameters, see Setting Environment Parameters.
- Request header
As shown in the following figure, the value of date in the request header is the date-to-timestamp conversion function. Parameter A in the function is the environment parameter date.
- Request body
As shown in the following figure, the request body uses the date-to-timestamp conversion function. Parameter A in the function is 2020.09.11 11:00:00.
- Checkpoint property
As shown in the following figure, the target value of the checkpoint property result is the date-to-timestamp function. Parameter A in the function is the environment 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 date-to-timestamp function. Parameter A in the function is 2020-09-11 11:00:00.
- for loop interrupt condition
As shown in the following figure, the target value of the for loop interruption condition is the date-to-timestamp function. Parameter A in the function is 2020-09-11 11:00:00.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.