---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../../modules.md) / [operations/metrics](../index.md) / MetricsTimeWindow

# Interface: MetricsTimeWindow

Defined in: [packages/b2c-tooling-sdk/src/operations/metrics/index.ts:102](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/67fb8580ac3c5b372617ee3ec3fc8f2bc9f16174/packages/b2c-tooling-sdk/src/operations/metrics/index.ts#L102)

Time-window options common to every metrics operation.

Accepts either a Date or a number of **epoch milliseconds** (the same
unit as `Date.now()`), for both `from` and `to`. Both are optional; when
omitted the API applies its default window. When both are supplied, `from`
must be before `to` or the API returns a 400.

> **Note:** The Metrics API wire format is epoch **seconds**, and the data
> points it returns are timestamped in **seconds**. These operations convert
> millisecond inputs to seconds on the way out and normalize response
> timestamps back to **milliseconds** on the way in, so callers work in
> JS-native millisecond time throughout (e.g. `new Date(point.timestamp)`).

## Extended by

- [`ThirdPartyMetricsOptions`](ThirdPartyMetricsOptions.md)
- [`ScapiMetricsOptions`](ScapiMetricsOptions.md)
- [`OcapiMetricsOptions`](OcapiMetricsOptions.md)

## Properties

### from?

> `optional` **from**: `number` \| `Date`

Defined in: [packages/b2c-tooling-sdk/src/operations/metrics/index.ts:104](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/67fb8580ac3c5b372617ee3ec3fc8f2bc9f16174/packages/b2c-tooling-sdk/src/operations/metrics/index.ts#L104)

Start of the window — a Date or epoch milliseconds (inclusive).

***

### to?

> `optional` **to**: `number` \| `Date`

Defined in: [packages/b2c-tooling-sdk/src/operations/metrics/index.ts:106](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/67fb8580ac3c5b372617ee3ec3fc8f2bc9f16174/packages/b2c-tooling-sdk/src/operations/metrics/index.ts#L106)

End of the window — a Date or epoch milliseconds (inclusive).
