Apache JMeter – dateTimeConvert Function

dateTimeConvert is an in-build function of Apache JMeter and its type is ‘Formatting’. The dateTimeConvert function converts the input date and time format into the required format. By the way, JMeter in-build functions are divided into eight categories which are:

  1. Information
  2. Input
  3. Calculation
  4. Formatting
  5. Scripting
  6. Properties
  7. Variables
  8. Strings
Apache JMeter - dateTimeConvert Function

Syntax: ${__dateTimeConvert()}

Type: Formatting

Purpose: To convert the date format either in epoch or human-readable format

Input Argument: The dateTimeConvert function has 4 arguments among them 2 are optional:

  • Date String: The input date string must be converted as per the target date format. A date as an epoch time could be used here if the Source Date Format is empty. It is a mandatory input argument.
  • Source Date Format: Specify the format of the input date string. If empty, the Date String field must be an epoch time.
  • Target Date Format: Specify the format of the output (required) date string.
  • Variable Name: Name of the variable in which the target date format value will be saved.

Return Value: This function returns the formatted date value.

Example:

FunctionOutput
${__dateTimeConvert(20240418,yyyymmdd,dd/mm/yyyy,)}18/04/2024
${__dateTimeConvert(1713400000000,,dd/MM/yyyy,)}18/04/2024

Limitation:

The function behaves incorrectly when you provide the time value, although there is no issue with date format conversion.


You may be interested:


Leave a Comment