# subtractUtc

Industry: Core

## Signature

```ts
subtractUtc(value: string, units: Partial<Record<keyof DurationLikeObject, number>>, options?: { overflow?: "reject" | "constrain" | undefined; }): string
```

Subtract a temporal amount from a UTC datetime string and return a new UTC Instant string.

- Uses Temporal.Instant.from to parse, subtracts duration, returns new Instant.
- Validates duration units and values.
- Returns "" for invalid input.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` | ISO UTC datetime string (e.g. "2024-03-10T12:00:00Z") |
| `units` | `Partial<Record<keyof DurationLikeObject, number>>` | Partial&lt;Record&lt;DateTimeDurationUnit, number&gt;&gt; object specifying units to subtract |

## Options

**options**

How an out-of-range result is handled

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `overflow?` | `"reject"` \| `"constrain"` ([`Overflow`](/gmt/reference/types/Overflow/)) | `"constrain"`, Temporal's default. | What to do when the result is not a real date. `"constrain"` clamps it to the last valid day, so Mar 31 − 1 month is Feb 29/28 (TC39 Temporal); `"reject"` returns `""`. |

## Returns

UTC Instant string after subtraction, or "" on invalid input

## Related types

- [`DateTimeDurationUnit`](/gmt/reference/types/DateTimeDurationUnit/)
- [`Overflow`](/gmt/reference/types/Overflow/)

## Examples

```ts
import { subtractUtc } from "@northguild/gmt/utc/calculate";

subtractUtc("2024-03-15T12:00:00Z", { days: 5 }) // "2024-03-10T12:00:00Z"
```

## Source

[utc/calculate/subtractUtc.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/utc/calculate/subtractUtc.ts)
