---
title: "__time"
description: "JMeter __time function reference: syntax, parameters, and practical examples for parameterizing test plans with dynamic values."
url: https://docs.jmeter.ai/functions/time/
lastUpdated: 2026-10-01
source: docs.jmeter.ai
---

# __time

*Also documented in context in the [full Functions and Variables reference](/user-manual/functions/#__time).*

**TL;DR:** `__time` returns the current date/time, formatted however you specify (or epoch milliseconds by default) — the standard way to stamp requests with a live timestamp for signing, cache-busting, or unique identifiers.

The time function returns the current time in various formats.

| Name | Required | Description |
| --- | --- | --- |
| Format | No | The format to be passed to [DateTimeFormatter](https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html).         The function supports various shorthand aliases, see below.         If omitted, the function returns the current time in milliseconds since the epoch. |
| Name of variable | No | The name of the variable to set. |

If the format string is omitted, then the function returns the current time in milliseconds since the epoch.
If the format matches “`/ddd`” (where `ddd` are decimal digits),
then the function returns the current time in milliseconds divided by the value of `ddd`.
For example, “`/1000`” returns the current time in seconds since the epoch.
Otherwise, the current time is passed to DateTimeFormatter.
The following shorthand aliases are provided:

- `YMD` = `yyyyMMdd`
- `HMS` = `HHmmss`
- `YMDHMS` = `yyyyMMdd-HHmmss`
- `USER1` = whatever is in the JMeter property `time.USER1`
- `USER2` = whatever is in the JMeter property `time.USER2`

The defaults can be changed by setting the appropriate JMeter property, e.g.
`time.YMD=yyMMdd`

```bash
\${__time(dd/MM/yyyy,)}
```

will return `21/01/2018` if ran on 21 january 2018

```bash
\${__time(YMD,)}
```

will return `20180121` if ran on 21 january 2018

```bash
\${__time()}
```

will return time in millis `1516540541624`

> **Note**
> The format to be passed to used to be [SimpleDateFormat](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html),
> but that changed with JMeter 5.5 to [DateTimeFormatter](https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html).
> While they use mostly the same codes, they differ slightly. Most notable is probably the code `u`, that meant
> *day number of week* and is now interpreted as *year*.

### Example

```plaintext
${__time(dd/MM/yyyy,)}   → 21/01/2026
${__time(/1000,)}        → epoch seconds
${__time(YMD,)}          → 20260121 (shorthand alias)
${__time(,epochMs)}      → epoch millis, stored in var "epochMs"
```

Frequently paired with HMAC signing in a [JSR223 PreProcessor](/components/jsr223-preprocessor/) for APIs that require a timestamp in the request signature.

## Related

- [Functions and Variables Guide](/topics/functions-and-variables/)
- [Regex Extractor Builder](/tools/regex-tester/)
- [Timers, Think Time & Pacing](/topics/timers-pacing-throughput-modeling/)
- [Full Functions Reference](/user-manual/functions/)
- [Component Reference](/user-manual/component-reference/)
