# getZonedNow

Industry: Core

## Signature

```ts
getZonedNow(ianaTimezone: string, optionsArg?: { smallestUnit?: PluralizeUnit<"minute" | "second" | "millisecond" | "microsecond" | "nanosecond"> | undefined; }): string
```

Return the current zoned datetime for the specified IANA timeZone.

- Uses Temporal.Now.zonedDateTimeISO() to get the current time.
- Validation is performed on the timezone.
- `smallestUnit` is the only option read. Any other key on `optionsArg` is ignored, so the string always carries the offset and the bracketed time zone, and smaller units are always truncated.
- An offset with seconds (`-00:44:30`) returns `""`. A written zone cannot carry seconds (RFC 9557 §4.1), so the result could not name it. Pass the IANA name, or call `fromOffsetInstant({ instant, offset })` for the local time with its full offset and no bracket.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `ianaTimezone` | `string` | IANA name or a UTC offset to the minute (what `isValidTimeZone` accepts) |

## Options

**optionsArg**

optional setting for the precision of the output string

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `smallestUnit?` | `PluralizeUnit<"minute" \| "second" \| "millisecond" \| "microsecond" \| "nanosecond">` | `"millisecond"` | The smallest unit written in the output string, from `"minute"` to `"nanosecond"`, singular or plural. Anything smaller is truncated, as Temporal's `toString` does with its `"trunc"` rounding mode. |

## Returns

zoned ISO 8601 datetime string or "" on invalid input

## Examples

```ts
import { getZonedNow } from "@northguild/gmt/zoned/get";

getZonedNow("Asia/Tokyo") // "2024-02-29T23:30:45.123+09:00[Asia/Tokyo]"
```

## Source

[zoned/get/getZonedNow.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/zoned/get/getZonedNow.ts)
